• I used this simple solution to make a whole li element clickable by using the href element contained in the li.

    <ul>
     <li class="fun">
      <img src="images/fun.png" alt="option1">
      <h3>Option 1</h3>
      <p><a href="http://www.google.se">Ut ut mauris ac nulla scelerisque interdum et et augue. Integer commodo tristique vestibulum. Donec urna diam, dictum feugiat ultricies ac, euismod at justo. Ac nulla scelerisque interdum</a>
      </p>

    Javascript
  • Simple solution to shift image in placeholder when clicking on a thumbnail of the image. The trick is to have the images named horse_large.png and horse_thumb.png for every picture.

    <div class="single-animal-image">
     <img src="images/horse_large.png" alt="horse" />
    </div>
    <div class="single-animal-thumb">
     <ul>
      <li><img src="images/horse_thumb.png" alt="thumb horse 1"></li>
      <li><img src="images/horse2_thumb.png" alt="thumb horse 2"></li>
     </ul>
    </div>

    And the jquery magic

    $('.single-animal-thumb img').click(function(){

    Javascript
  • ls -lh | less

    Will make it possible to scroll up and down the whole list and q key will end the listing

    Server
  • Remove file from repo

    git rm --cached filename

    Remove commit

    git reset --hard HEAD~1

    Git
  • Got this error while trying the Titanium app on an android emulator. The app used a tableview to list data from a json feed.
    The solution that worked was to simply disable the classname attribute on the tableveiws rows.

    // Give each row a class name and the code is disabled
    row.className = "item"+i;

    Another solution was suggested to "when building the custom rows some views would be added depending on a variable, When disabled this all views were added no matter what and now it works fine"

    Javascript, Titanium
  • Got stuck with this for a while last night when i tried to get the day out of a datetime value.
    Original code

    $day = date('l', $date->ct_day_start);

    That produced the error "A non well formed numeric value encountered". The solution was to make use of strtotime like this.
    $day = date('l', strtotime($date->ct_day_start));

    Hopefully i dont forget this next time :)

    PHP
  • Just my own notes so i dont forget.

    Kranium
    Install node/npm"
    Kranium needs node.js and npm.

    mkdir ~/local
    mkdir ~/node-latest-install
    cd ~/node-latest-install
    curl <a href="http://nodejs.org/dist/node-latest.tar.gz" title="http://nodejs.org/dist/node-latest.tar.gz">http://nodejs.org/dist/node-latest.tar.gz</a> | tar xz --strip-components=1
    ./configure --prefix=/opt/node
    make install # ok, fine, this step probably takes more than 30 seconds...
    curl <a href="http://npmjs.org/install.sh" title="http://npmjs.org/install.sh">http://npmjs.org/install.sh</a> | sh

    Javascript, Kranium, Titanium
  • defaults write com.apple.dock persistent-apps -array-add '{"tile-type"="spacer-tile";}'; killall Dock

    Mac
  • First use this to check what formats the server supports

    system('locale -a'); 

    After that its a matter of using setlocate and strftime to change it to swedish output

    setlocale( LC_TIME, 'sv_SE.utf8');  
    $date = strftime('%e %B',$node->field_event_date['und'][0]['value']);

    PHP
  • To split url http://localhost/anything/goes/tonight

    var link = location.pathname.split("/");

    That gives array like this

    ["", "anything", "goes", "tonight"]
    var goes = link[2]; // put array value goes into var goes

    Javascript