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 |
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
grey='\e[0;90m' | |
ZSH_THEME_GIT_PROMPT_PREFIX="%{$grey%}(" | |
ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%}" | |
ZSH_THEME_GIT_PROMPT_DIRTY="%{$grey%}) %{$fg[yellow]%}✗%{$reset_color%}" | |
ZSH_THEME_GIT_PROMPT_CLEAN="%{$grey%})" | |
function pat_prompt { | |
(( spare_width = ${COLUMNS} )) | |
prompt=" " |
OlderNewer