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
### Keybase proof | |
I hereby claim: | |
* I am joshprice on github. | |
* I am joshprice (https://keybase.io/joshprice) on keybase. | |
* I have a public key whose fingerprint is 08EA 0ACE 6A62 A852 259B 743C 6749 8211 1E02 CE56 | |
To claim this, I am signing this object: |
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
String.prototype.reverse = function() { | |
return this.split("").reverse().join(""); | |
} | |
Number.prototype.formatAsCurrency = function() { | |
return this.toString() | |
.replace(/^(\d)$/, "00$1") // pad 1 digit | |
.replace(/^(\d{2})$/, "0$1") // pad 2 digits | |
.reverse() | |
.replace(/(\d{2}(?=\d))/, "$1.") // place decimal point |
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
IO.read("testfile") # reads testfile in as a string | |
IO.readlines("testfile") # reads testfile in as an array |
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
IO.read("testfile") # reads testfile in as a string | |
IO.readlines("testfile") # reads testfile in as an array |
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
// | |
// Define this.constructor.name so we can introspect an object for it's constructor's name | |
// (equivalent to the 'Class' name if there were classes...) | |
// This is necessary because IE does not define this constructor property but FF does. | |
// | |
Function.prototype.getName = function() { | |
var matches = this.toString().match(/function\s+([\w\$]+)\s*\(/); | |
return matches ? matches[1] : ''; | |
}; |
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() { | |
var controlPanel = (<r><![CDATA[ | |
<div id='controlpanel'> | |
<h1>First</h1> | |
<ul> | |
<li>HappyPath</li> | |
</ul> | |
<h1>Second</h1> |
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
require "rubygems" | |
require "webrick/httpproxy" | |
module WEBrick | |
class HTTPRequest | |
attr_writer :host, :port, :request_uri, :unparsed_uri, :request_line, :path | |
end | |
end | |
class MultiplexingProxy < WEBrick::HTTPProxyServer |
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
javascript:(function(){var%20j=document.createElement('script');j.setAttribute('type','text/javascript');j.setAttribute('src','http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js');document.body.appendChild(j);})(); |
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
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> | |
<html> | |
<head> | |
<style> | |
.wrapper { border: 1px solid black; } | |
.wrapper h3 a { float: right; } | |
</style> | |
<!--[if lte IE 7]> | |
<style> |
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
helpers do | |
def mobile_request? | |
[ /AppleWebKit.*Mobile/, /Android.*AppleWebKit/ ].any? {|r| request.env['HTTP_USER_AGENT'] =~ r} | |
end | |
def mobile_file(name) | |
File.exist?("#{options.views}/#{name}#{@mobile}.haml") ? :"#{name}#{@mobile}" : name.to_sym | |
end | |
def partial(name) | |
haml mobile_file("_#{name}"), :layout => false | |
end |
OlderNewer