Skip to content

Instantly share code, notes, and snippets.

View zedd45's full-sized avatar
😁
I may be slow to respond.

Chris Keen zedd45

😁
I may be slow to respond.
View GitHub Profile
@cjohansen
cjohansen / gist:739589
Created December 13, 2010 20:55
Showing how to fake server requests with Sinon.JS and Jasmine
/*
Load Sinon.JS in the SpecRunner:
<script type="text/javascript" src="lib/jasmine-1.0.1/jasmine.js"></script>
<script type="text/javascript" src="lib/jasmine-1.0.1/jasmine-html.js"></script>
<script type="text/javascript" src="sinon-1.0.0.js"></script>
<script type="text/javascript" src="sinon-ie-1.0.0.js"></script>
http://cjohansen.no/sinon/
*/
@craveytrain
craveytrain / client-withCredentials.js
Created June 16, 2011 02:20
Cross domain scripting with jQuery
$.ajaxPrefilter('json', function(options, orig, jqXHR) {
if (options.crossDomain && !$.support.cors) return 'jsonp'
});
$.ajax({
url: 'http://nodeserver:3000',
dataType: 'json',
success: callback,
xhrFields: {
withCredentials: true
@mxcl
mxcl / uninstall_homebrew.sh
Created August 26, 2011 11:25
Uninstall Homebrew
#!/bin/sh
# Just copy and paste the lines below (all at once, it won't work line by line!)
# MAKE SURE YOU ARE HAPPY WITH WHAT IT DOES FIRST! THERE IS NO WARRANTY!
function abort {
echo "$1"
exit 1
}
set -e
@pthrasher
pthrasher / simplate.php
Created February 2, 2012 17:23
A very very simple templating class for php... seriously... probably has too few features.
<?php
class Simplate {
/*
* Sets include file name, and sanitizes vars.
*/
function __contruct($template_name = '404', $vars = array()) {
// Escapt all values by default.
$this->template_vars = $this->sanitize_vars($vars);
@lorennorman
lorennorman / custom-pipe.js
Created February 9, 2012 03:56
ATLRUG Presentation: Asset Pipelines and You, 2-2012
app.get('/javascript/:buildable_js_file', function(req, res)
{
var jsFilename = req.params.buildable_js_file
, staticPath = 'public/javascript/' + jsFilename
, buildPath = 'app/client/' + jsFilename
, buildDir = buildPath.replace('.js', '')
, serveJS = function(jsString)
{
res.header('Content-Type', 'application/javascript')
res.send(jsString)
@chriseppstein
chriseppstein / 0_usage.scss
Created February 29, 2012 19:29
This is code that runs using Sass 3.2 prerelease and something like this will be in compass soon.
@include keyframes(appear-and-roundify) {
0% { opacity: 0; @include border-radius(2px); }
100% { opacity: 1; @include border-radius(10px); }
}
@steckel
steckel / faux-browser.coffee
Created March 14, 2012 04:59
jQuery.plugin boilerplate spec (for use with Mocha and Should.js)
root = if window? then window else global
root.$ = require("jquery")
root.jQuery = $
@trey
trey / happy_git_on_osx.md
Last active March 10, 2025 23:53
Creating a Happy Git Environment on OS X

Creating a Happy Git Environment on OS X

Step 1: Install Git

brew install git bash-completion

Configure things:

git config --global user.name "Your Name"

git config --global user.email "[email protected]"

@ancestral
ancestral / ASCII JS Keyboard Map
Created July 6, 2012 04:33
ASCII keyboard map for JavaScript keycodes (Mac)
/*
* JavaScript Keyboard Map (Mac layout)
*
*
* escβ€”β€” F1β€”β€”β€” F2β€”β€”β€” F3β€”β€”β€” F4β€”β€”β€” F5β€”β€”β€” F6β€”β€”β€” F7β€”β€”β€” F8β€”β€”β€” F9β€”β€”β€” F10β€”β€” F11β€”β€” F12β€”β€” F13β€”β€”β€”β€”β€”+
* | 27 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | ??? |
* ` β€”β€”β€” 1β€”β€”β€”β€” 2β€”β€”β€”β€” 3β€”β€”β€”β€” 4β€”β€”β€”β€” 5β€”β€”β€”β€” 6β€”β€”β€”β€” 7β€”β€”β€”β€” 8β€”β€”β€”β€” 9β€”β€”β€”β€” 0β€”β€”β€”β€” - β€”β€”β€” = β€”β€”β€” deleteβ€”β€”+
* | 192 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 |
* tabβ€”β€”β€”β€” Qβ€”β€”β€”β€” Wβ€”β€”β€”β€” Eβ€”β€”β€”β€” Rβ€”β€”β€”β€” Tβ€”β€”β€”β€” Yβ€”β€”β€”β€” Uβ€”β€”β€”β€” Iβ€”β€”β€”β€” Oβ€”β€”β€”β€” Pβ€”β€”β€”β€” [ β€”β€”β€” ] β€”β€”β€” \ β€”β€”β€”β€”+
* | 9 | 81 | 87 | 69 | 82 | 84 | 89 | 85 | 73 | 79 | 80 | 219 | 221 | 220 |
@staltz
staltz / introrx.md
Last active April 1, 2025 06:30
The introduction to Reactive Programming you've been missing