This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Luhn's algorithm in javascript with prototype. | |
* | |
* This is used for credit card number validation. | |
* | |
* You'll have to scrub the number before passing it in. If any | |
* non-numeric characters are passed then this will fail. | |
* | |
* @see http://en.wikipedia.org/wiki/Luhn_algorithm | |
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# I'm using this | |
base = File.expand_path(File.join(File.dirname(__FILE__))) | |
app = Rack::File.new(base) | |
routes = Usher::Interface.for(:rack) do | |
add("/static/(js|css|img)/:file").to(app) | |
end | |
# It would be nice to use this. I made the paths different |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sometimes, when adding a branch like so: | |
`fetch = path/to/branch:refs/remotes/git-svn/mynewbranch` | |
the path to the branch is mispelt. | |
You then go ahead and do a `$ git svn fetch` and git finds nothing. You realize what an incredible dolt you are and fix the path, | |
`fetch = realpath/to/branch:refs/remotes/git-svn/mynewbranch` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
PubSub = { | |
initPubSub: function() { | |
this._dummy = new Element('span'); | |
}, | |
fire: function(event, memo) { | |
this._dummy.fire(event, memo); | |
}, | |
observe: function(event, handler) { | |
this._dummy.observe(event, handler); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0"?> | |
<!DOCTYPE html PUBLIC | |
"-//W3C//DTD XHTML 1.1 plus MathML 2.0 plus SVG 1.1//EN" | |
"http://www.w3.org/2002/04/xhtml-math-svg/xhtml-math-svg-flat.dtd"> | |
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" | |
xmlns:svg="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"> | |
<head> | |
<title>Test</title> | |
<script type="text/javascript" src="/static/js/jquery.js"></script> | |
<script type="text/javascript" src="/static/js/jquery-svg/jquery.svg.js"></script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
pkill wpa | |
iwconfig wlan0 mode Ad-Hoc | |
iwconfig wlan0 essid AndroidTether | |
iwconfig wlan0 ap <incredible wifi mac address> | |
ifconfig wlan0 up |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function(my_selector) { | |
var old_jQuery = jQuery; | |
var doWork = function() { | |
var my_jQuery = jQuery.noConflict(); | |
jQuery = old_jQuery; | |
// load up myplugin on my_jQuery | |
my_jQuery(my_selector).myplugin({...}); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# Ideas taken from http://www.mikerubel.org/computers/rsync_snapshots/ | |
# | |
# This increments all backup numbers and deletes or moves the last one | |
# to a monthly backup depending on the date. | |
# | |
# WARNING: This code breaks badly if you try and backup to dirs with the | |
# same basename! There is no safety mechanism. | |
# where backups are stored |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function($) { | |
$('a'); | |
})(YAHOO.util.Selector.query); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$PER_YEAR = 1.07 | |
def appreciate(value, years) | |
return value if years == 0 | |
appreciate(value * $PER_YEAR, years - 1) | |
end | |
# my home was sold for 52k in 95' | |
puts appreciate(52000, 16) | |
# >> 153512.514925401 |
OlderNewer