Skip to content

Instantly share code, notes, and snippets.

@dkordik
dkordik / pitchforkfestival2012bands.js
Created July 5, 2012 22:59
Pitchfork Festival 2012 bands
//http://pitchfork.com/festivals/chicago/2012/
$(".appearance a").map(function () { return $(this).html().split("<")[0].trim() })
@dkordik
dkordik / highlightCompleted.js
Created May 29, 2012 06:04
Ebay completed listings: make unsold items REALLY red and sold items REALLY green. to see what's gettin bought!
$(".binsold").each(function () {$(this).closest("td").css("backgroundColor","red")});
$(".bidsold").each(function () {$(this).closest("td").css("backgroundColor","green")});
@dkordik
dkordik / Terminal.sublime-settings
Created May 3, 2012 18:02
Sublime Text 2 Terminal config with mintty/cygwin/bash to open a terminal in the current directory
{
"terminal": "C:/cygwin/bin/mintty.exe",
"parameters": ["/bin/env", "CHERE_INVOKING=1", "/bin/xhere", "/bin/bash", "`%CWD%`"]
}
@dkordik
dkordik / Terminal.sublime-settings
Created May 2, 2012 15:36
Sublime Text 2 Terminal config with Console2/cygwin/bash to open a terminal in the current directory
{
"terminal": "C:/Program Files/Console2/Console.exe",
// In Console2 "Shell" section, have just "bash" with no args in a profile called "Terminal"
"parameters": ["-t", "Terminal", "-r", "/bin/xhere /bin/bash.exe", "`%CWD%`"]
}
@dkordik
dkordik / seizure.js
Created January 19, 2012 22:34
Seizure.js - experiment in doing more UI manipulation in JS than a "stop script?" limit would allow
//concept from http://www.sitepoint.com/multi-threading-javascript/
var $visibleElements = $(":visible");
var random255 = function () {
return Math.floor(Math.random()*255);
}
var randomColor = function () {
return "rgb(" + random255() + "," + random255() + "," + random255() + ")";
}
@dkordik
dkordik / regtest-live.js
Created November 29, 2011 17:59
Make this JS regex tester site update as you type (after jQuerifying with FireQuery): http://www.pagecolumn.com/tool/regtest.htm
$jq("textarea").live("keyup",function () { $jq("#button1").click() }
@dkordik
dkordik / object_class.js
Created October 6, 2011 21:13
Ruby's .class for Javascript... kinda
Object.prototype.class = function () {
var match = this.constructor.toString().match("function " + /([A-Za-z]+)/.source) || this.constructor.toString().match("return new " + /([A-Za-z]+)/.source);
return match[1];
}
@dkordik
dkordik / addCommasToNumber.js
Created September 6, 2011 21:37
Add comma separators to numbers
function addCommasToNumber(n) {
return n.toString().split('').reverse().join('').match(/(.{1,3})/g).join(',').split('').reverse().join('');
}
@dkordik
dkordik / get_awesome_script
Created August 19, 2011 18:42
Outputs a JS function that will automatically click "Awesome" every 45 sec in turntable.fm
#!/bin/bash
#put your cookie in here. get it by putting javascript:alert(document.cookie) into the address bar
#when you're on turntable.fm and hit ctrl+c to copy it.
cookie='PASTE YOUR COOKIES IN HERE'
echo "Scraping..."
wget -4 -O OUTPUT --user-agent='Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.17) Gecko/20110422 Ubuntu/10.04 (lucid) Firefox/3.6.17' --no-cookies --header "Cookie: $cookie" -r -q http://turntable.fm/zzzapp
id=`grep -o block\;cursor\:pointer\;\}#.*\{background\:url\(\'https\:\/\/s3\.amazonaws\.com\/static\.turntable\.fm\/roommanager_assets\/props\/vote_btns\.png OUTPUT | awk -F '#' '{print $2}' | awk -F '{' '{print $1}'`
@dkordik
dkordik / heyTwitterUmad.js
Created July 7, 2011 19:52
Check to see if Twitter is back up. I use it to let me know when we're no longer rate-limited and I can get back to working on Twitter stuff.
i = setInterval(function () {
jQuery.ajax({
url: 'http://twitter.com/users/show_for_profile.json?screen_name=dkordik',
complete: function (data) {
if (JSON.parse(data.responseText)["error"]==undefined) {
alert("IT'S BACK BABY!"); //brings focus to the twitter tab!
clearInterval(i);
location.reload();
} else {
console.log("TWITTER? ", JSON.parse(data.responseText)["error"], " " + Date().toString());