| _ \ _) | _ \ \ \ / -_) __/ _` | | \ ____| \___/ \_/ \___| _| \__,_| _| _| _| __ __| | \ \ / | | | \ -_) \ \ \ / \ _ \ | -_) _| _| _| \___| \_/\_/ _| _| \___/ _| \___| __| __ __| | _) ( _| _` | _ / | | | \ | \ _` | \___| _| \__,_| ___| \_, | _| _| _| _| _| _| \__, | ___/ ____/ Quind�o (Department) Jazz Animal Training Gondar Antioch (CA) Tianjin (municipality) Tangshan Arcadia (CA) Decatur (AL) Real Madrid F.C. Lille Flevoland Muscatine (IA)

May 04

Evening Depress

Following in the steps of the Pish & Churnal and Empty News scripts, I offer today’s Evening Depress…

Evening Depress screenshot

The download link below should ask to install it in chrome, if you’re using Firefox you’ll need Greasemonkey to run it. Install then head on over to the Evening Depress site…

Download (Downloaded 16 times)

Apr 07

Rotate elements jQuery bookmarklet

Ever seen when someone’s uploaded an image or a video shot on their iPhone or uploaded badly so that it’s displaying sideways or upside-down online? Yeah I have too. It’s annoying trying to crick your neck just to view the object. Hence this bookmarklet(drag the “↵” link to your bookmark bar)…
Each click on the element after you’ve activated the bookmarklet will rotate it clockwise by 90 degrees. Try it out now, click the link below, after clicking OK click on this paragraph. and again, and again… not bad eh!?

<a href="javascript:(function(){var s = document.createElement('script');s.src = 'http://code.jquery.com/jquery-1.7.2.min.js';document.body.appendChild(s);var s = document.createElement('script');s.src = 'http://the-kid.org/scripts/rotateElements.js';document.body.appendChild(s);})();">↵</a>

The eagle-eyed among you will note that this loads a couple of scripts remotely. Firstly it loads jQuery from the official jQuery CDN. This is so I can access some framework dependant functionality surrounding rotating elements, used by the second script the bookmarklet loads (here is the script the top bit is the jQueryrotate plugin just embedded into the script)

The important bits are the line in the second file…

var rotation = -90;
    function assignElement()
    {
        alert("Click target element");
        $(document).ready(function(){
            $("*").click(function(event){
                elementSelect = event.target;
                $("*").unbind("click");
                elSel(elementSelect);
            });
        });
    }
    function elSel(elementSelect)
    {
        $(elementSelect).click(function(){
            if(rotation<360)rotation += 90;
            else rotation=0;
            $(elementSelect).rotate({
                bind:{
                    click: function(){
                        $(this).rotate({ angle:0,animateTo:rotation,easing: $.easing.easeInOutExpo })
                    }
                }
            });
        })
    }
    assignElement();

The assignElement() function defines exactly what you want to rotate on the page, the elSel() function binds the rotation to clicks on the element.
It's very hack-ish(and feels it!) but it works somewhat. Sometimes you need to click two or three times on the element to get it rotating, probably because of how I've nested the elSel() function.

Mar 06

Back to top bookmarklet(s)

How annoying is it when a page induces an infinite scroll technique or is just long and they don’t provide you with a mechanism to get back to the top of the page? (that’s rhetorical but the answer is “quite”!)

Here’s a simple-tastic bookmarklet(drag the “↑” link to your bookmark bar) so everywhere can have it…

<a href="javascript:window.scroll(0,0);" onclick="window.scroll(0,0);">&uarr;</a>

[edit]
Mitchinator suggested I make a jQuery enabled version for some smoothness. So here we go… falls back to instant if page isn’t jQuery enabled…

<a href="javascript:if(typeof jQuery === 'undefined' || !jQuery) {window.scroll(0,0);}else{jQuery('body').animate({scrollTop:0}, 1200);}" onclick="if(typeof jQuery === 'undefined' || !jQuery) {window.scroll(0,0);}else{jQuery('body').animate({scrollTop:0}, 1200);}">&uarr;</a>

Sep 20

AMV files in Linux – revisited

I just did a re-write of one of my most popular hits on this blog. It was all documented in the comments of the script’s page but it’s a bit of a mess so here’s the definitive step-by-step walkthrough to converting your videos to AMV format in Linux (I use Ubuntu 10.04) If you can’t make out the pictures in this post click on them to make them bigger – remember, they’re only pictures, not real dialog windows… ;oP

  1. Open a terminal window
  2. sudo apt-get install subversion
    svn checkout http://amv-codec-tools.googlecode.com/svn/trunk/ amv-codec-tools
    cd amv-codec-tools/AMVmuxer
    make build
    Allow this to finish, it takes a good few minutes
  3. sudo apt-get install nautilus-actions
  4. cd
    gedit
  5. Paste the following code into that file
    #!/bin/bash
    for uri in $@; do
    INFILE=$uri
    FORMAT=${INFILE:(-4)}
    OUTFILE=${INFILE/$FORMAT/.amv}
    cd ~/amv-codec-tools/AMVmuxer ;
    ./ffmpeg/ffmpeg -i "$INFILE" -f amv -r 16 -s 160x120 -ac 1 -ar 22050 -qmin 3 -qmax 3 "$OUTFILE" ;
    zenity --title "$FORMAT to .amv File Conversion Complete" --info --text="${INFILE/file:\/\// } has converted \n\nCheck ${OUTFILE/file:\/\// }";
    done

    …save file as ‘convert to amv’ and close the file
  6. back in the terminal…nautilus-actions-config-tool
  7. In the window that pops up, click new and make it look like this (don’t worry about the shred file and wipe free space stuff, we’re only interested in the Convert to amv stuff):


    note the different tabs that are open, also note where quotation marks have been used
  8. Save the configuration
  9. Close the nautilus actions configuration tool window
  10. Close the terminal window
  11. In nautilus navigate to a file you want converted
  12. Right click on it, you should see this menu itemgo ahead and select that
  13. After some time, how long depends on the size of the file, you’ll get a dialog box looking something like this
  14. Go ahead and play the file (I use GNOME MPlayer for amv files “sudo apt-get install gnome-mplayer” but vlc plays them too. You may need codecs.)

Hopefully that’ll be you sorted but there are a few points to note…

  1. Spaces in file or path names – it can’t handle them
  2. You can do multiple files on the one click, it’ll do them one at a time
  3. Some file types won’t convert without messing with ffmpeg – notably mp4/mp3/3gp – these can be made to work but that’s outside the scope of this, importantly flv files convert perfectly so your youtube downloads will work ;oP
  4. This was written using Ubuntu – I can’t be certain it’ll work with other distros

go stick your amv files onto your iteddy or ipod-esque thingy and play to your hearts content!

Older posts «