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 February 18, 2024 10:46
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 "you@example.com"

@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 June 21, 2024 12:27
The introduction to Reactive Programming you've been missing