Skip to content

Instantly share code, notes, and snippets.

View sheepsteak's full-sized avatar

Chris Shepherd sheepsteak

View GitHub Profile
@sgentile
sgentile / KnockoutJsHistory
Created May 13, 2011 14:32
KnockoutJS with History
<!doctype html>
<html lang="en">
<head>
<title>knockout binding test</title>
<style type="text/css">
#sidebar { float: left; width: 15em; }
#details { float: left; }
#sidebar li { list-style: none; }
#sidebar a { list-style: none; background-color: silver; width: 8em; margin-bottom: 0.5em; padding: 0.5em; display:block; }
#sidebar a.selected { background-color: Navy; color: white; }
@scottmessinger
scottmessinger / 1.router.js
Created September 21, 2011 22:29
Routing in KO with Backbone.js
App.Router = Backbone.Router.extend({
routes : {
"" : "home"
,"/" : "home"
,"!" : "home"
,"!/" : "home"
,"!/:username" : "show_user"
,":username" : "show_user"
,":username/" : "show_user"
@domenic
domenic / README.md
Created March 29, 2012 16:01
Cross-platform git hooks for Node.js

Here's how this works:

  • Include a git_hooks/ directory in your project, with these two files (plus other hooks if you want, written in a similar style).
  • Add "npm" to your devDependencies in package.json, so that the pre-commit hook can do its magic.
  • Add test and lint scripts to your package.json, e.g.
    "scripts": {
        "test": "mocha",
 "lint": "jshint ./lib --show-non-errors"
@jexchan
jexchan / multiple_ssh_setting.md
Created April 10, 2012 15:00
Multiple SSH keys for different github accounts

Multiple SSH Keys settings for different github account

create different public key

create different ssh key according the article Mac Set-Up Git

$ ssh-keygen -t rsa -C "your_email@youremail.com"
@rocketnova
rocketnova / tm2iterm.rb
Created June 19, 2012 20:45 — forked from maxim/tm2iterm.rb
Convert TextMate themes into iTerm 2 color schemes.
#!/usr/bin/env ruby
#
# This script is an astonishing feat of top notch
# rockstar craftsmanship. It totally uses artificial
# intelligence to extract colors out of tmTheme and
# build an itermcolors scheme file for iTerm2.
#
# I know this sounds crazy, but it actually knows
# approximately what colors should be used in the
# ANSI list, and tries to find nearest colors from
(function($) {
function parseImagesFromCSS(doc) {
var i, j,
rule,
image,
pattern = /url\((.*)\)/,
properties = ['background-image', '-webkit-border-image'],
images = {};
if (doc.styleSheets) {
@irace
irace / BIWebViewDelegate.m
Created September 10, 2012 02:51
JavaScript/native bridge for iOS's UIWebView
- (BOOL)webView:(UIWebView *)webView shouldStartLoadWithRequest:(NSURLRequest *)request
navigationType:(UIWebViewNavigationType)navigationType {
NSString *urlString = [[request URL] absoluteString];
if ([urlString hasPrefix:@"js:"]) {
NSString *jsonString = [[[urlString componentsSeparatedByString:@"js:"] lastObject]
stringByReplacingPercentEscapes];
NSData *jsonData = [jsonString dataUsingEncoding:NSUTF8StringEncoding];
NSError *error;
@evanlarsen
evanlarsen / transitionHelper.js
Last active February 8, 2021 17:12
Durandal transition helper file. This imposes that you are using https://github.com/daneden/animate.css Also, that you have changed the animation duration in animate.css from 1s to .3s
define(function(require) {
var system = require('../system');
var animationTypes = [
'bounce',
'bounceIn',
'bounceInDown',
'bounceInLeft',
'bounceInRight',
'bounceInUp',
@jeppeburchardt
jeppeburchardt / msbuild node gyp
Created July 17, 2013 12:54
node gyp msbuild misssing registry warning MSB8003: Could not find WindowsSDKDir variable from the registry. TargetFrameworkVersion or PlatformToolset may be set to an invalid version number
call "C:\Program Files\Microsoft SDKs\Windows\v7.1\bin\Setenv.cmd" /Release /x86
call "C:\Program Files\Microsoft SDKs\Windows\v7.1\bin\Setenv.cmd" /Release /x64
@freshlogic
freshlogic / app.js
Last active March 5, 2024 17:11
HACK: Azure doesn't support X-Forwarded-Proto so we add it manually
var express = require('express');
var app = express();
app.enable('trust proxy');
// HACK: Azure doesn't support X-Forwarded-Proto so we add it manually
app.use(function(req, res, next) {
if(req.headers['x-arr-ssl'] && !req.headers['x-forwarded-proto']) {
req.headers['x-forwarded-proto'] = 'https';
}