Skip to content

Instantly share code, notes, and snippets.

View jaredatron's full-sized avatar

Jared Grippe jaredatron

View GitHub Profile
# this is still fucking rad!
class SendRecorder < BlankSlate
def initialize(host)
@__host__ = host
@__called__ = []
end
attr_reader :__host__, :__called__
def __called?(method)
__called__.include? method.to_sym
/** Console X
*
* prevents console errors and makes IE console objects true functions
*
*/
(function() {
window.console || (window.console = {});
var names = ["log", "debug", "info", "warn", "error", "assert", "dir", "dirxml",
"group", "groupEnd", "time", "timeEnd", "count", "trace", "profile", "profileEnd"];
// the base Klass object that all Klasses are extended from
var Klass;
// calling new class creates a new class
var Frog = klass.create({});
// synonymous with new klass
// calling class (without new) extends the given klass
klass(Frog, {});
// => Frog (extended)
Error.prototype.stackTrace = function(){
var stack_trace = this.stack.split("\n").map(function(line){
if (!line) return line;
line = line.match(/(.*?):(\d+)/);
return {
line: line[1],
line_number: line[2]
}
});
stack_trace.pop();
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>KeepAlive</key>
<true/>
<key>Label</key>
<string>org.openssh.dynamic-proxy</string>
<key>LimitLoadToSessionType</key>
<string>Aqua</string>
(function(){
var secret;
function get(){
return secret;
};
function set(value){
return secret = value;
// functions always run in the context of the object they are attached to
// unless you use the apply or call methods
function add_a_fish(){
this.fish = 'smelly';
}
add_a_fish();
fish
<html>
<head>
<title>JavaScript Test</title>
<script src="jquery.js" type="text/javascript"></script>
<script type="text/javascript">
function init() {
$.getJSON(
"http://127.0.0.1:3000/",
function(data) {
alert('hello world');
<html>
<head>
<title>JavaScript Test</title>
<script src="/test/jquery.js" type="text/javascript"></script>
<script type="text/javascript">
$(document).ready(function(){
$.getJSON(
"http://127.0.0.1:3000/",
function(data) {
alert('hello world');
<html>
<head>
<title>JavaScript Test</title>
<script src="/test/jquery.js" type="text/javascript"></script>
<script type="text/javascript">
$(document).ready(function(){
console.log("I'm JavaScript and I'm getting ready to fail but not let you know why.");
$.getJSON(
"http://127.0.0.1:3000/",
function(data) {