Skip to content

Instantly share code, notes, and snippets.

@ismasan
ismasan / gist:464257
Created July 5, 2010 11:30
Event-emitter module for Javascript objects
/* Abstract event binding
Example:
var MyEventEmitter = function(){};
MyEventEmitter.prototype = new AbstractEventsDispatcher;
var emitter = new MyEventEmitter();
// Bind to single event
emitter.bind('foo_event', function(data){ alert(data)} );
@msanders
msanders / NSColor+CGColor.m
Created November 20, 2010 16:11
Category for AppKit that converts an NSColor to a CGColor (ala UIColor in the iOS)
//
// NSColor+CGColor.m
//
// Created by Michael Sanders on 11/19/10.
//
#import "NSColor+CGColor.h"
@implementation NSColor (CGColor)
@balupton
balupton / README.md
Last active April 20, 2022 13:21
Ajaxify a Website with the HTML5 History API using History.js, jQuery and ScrollTo
@jankuca
jankuca / index.js
Created March 17, 2011 09:48
Simple Facebook Graph API Node.js Client
var HTTPS = require('https');
var QueryString = require('querystring');
/**
* Facebook API Wrapper
* @constructor
* @param {Object} info Info about the Facebook application
*/
var Client = function (info) {
if (!info.id) {
@kylebarrow
kylebarrow / example.html
Created June 23, 2011 06:30
Prevent links in standalone web apps opening Mobile Safari
<!DOCTYPE html>
<head>
<title>Stay Standalone</title>
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no">
<script src="stay_standalone.js" type="text/javascript"></script>
</head>
<body>
<ul>
<li><a href="http://google.com/">Remote Link (Google)</a></li>
@kylefinley
kylefinley / main.coffee
Created November 21, 2011 11:47
SproutCore 20 Routing + Statechart
require 'sproutcore'
require 'sproutcore-statechart'
require 'sproutcore-routing'
App = SC.Application.create()
App.GlobalNavController = SC.Object.create(
home: -> App.statechart.gotoState 'home'
about: -> App.statechart.gotoState 'about'
)
@piscisaureus
piscisaureus / pr.md
Created August 13, 2012 16:12
Checkout github pull requests locally

Locate the section for your github remote in the .git/config file. It looks like this:

[remote "origin"]
	fetch = +refs/heads/*:refs/remotes/origin/*
	url = git@github.com:joyent/node.git

Now add the line fetch = +refs/pull/*/head:refs/remotes/origin/pr/* to this section. Obviously, change the github url to match your project's URL. It ends up looking like this:

@jhankin
jhankin / SOInsetLabel.h
Created November 5, 2012 19:11
UILabel subclass encapsulating interior shadow functionality
//
// SOInsetLabel.h
//
// Created by Joseph Hankin on 11/2/12.
// From code posted by Rob Mayoff.
// http://stackoverflow.com/questions/8467141/ios-how-to-achieve-emboss-effect-for-the-text-on-uilabel
// Copyright (c) 2012 Joseph Hankin. All rights reserved.
//
@royosherove
royosherove / gist:4046346
Created November 9, 2012 15:34
simple angular js to search and display youtube videos
<head >
<script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.0.2/angular.min.js"></script>
<script type="text/javascript">
function PhoneListCtrl($scope, $http){
var dataurl ='http://gdata.youtube.com/feeds/api/videos?q="string%20calculator"%20kata%20-tekpub%20-movie&orderby=rating&alt=json';
$http.get(dataurl).success(function(data){