Skip to content

Instantly share code, notes, and snippets.

View aarontam's full-sized avatar

Aaron T aarontam

  • San Francisco, CA
View GitHub Profile
@ryanjduffy
ryanjduffy / README.md
Last active August 29, 2015 14:27
Console jsperf

Usage Example

// Setup code before all tests are ran
jsperf.before(function () {
   testStr = '-1/2';
});

// Teardown code after all tests are ran
jsperf.after(function () {
@dmikey
dmikey / enyo.Once.js
Last active August 29, 2015 14:04
Gives Enyo the ability to generate functions that can only be executed ONE time, regardless of how many times it is called.
(function(enyo, scope){
/**
* _enyo.Once_ returns a function that will only be executed one time no matter
* how many times it was called.
*
* borrowed from underscore
*
* @class enyo.Once
* @public
@ada-lovecraft
ada-lovecraft / gist:8115700
Last active January 1, 2016 07:59
The Power of Promises
// Promises on their own seem to be cumbersome compared to basic callbacks
a = new DataService(aUrl);
// Single Callback
a.async(function(data) {
doAfter(data);
});
// Single Promise
@paulirish
paulirish / gist:4158604
Created November 28, 2012 02:08
Learn JavaScript concepts with recent DevTools features

Learn JavaScript concepts with the Chrome DevTools

Authored by Peter Rybin , Chrome DevTools team

In this short guide we'll review some new Chrome DevTools features for "function scope" and "internal properties" by exploring some base JavaScript language concepts.

Closures

Let's start with closures – one of the most famous things in JS. A closure is a function, that uses variables from outside. See an example:

@caniszczyk
caniszczyk / clone-all-twitter-github-repos.sh
Created October 9, 2012 04:25
Clone all repos from a GitHub organization
curl -s https://api.github.com/orgs/twitter/repos?per_page=200 | ruby -rubygems -e 'require "json"; JSON.load(STDIN.read).each { |repo| %x[git clone #{repo["ssh_url"]} ]}'
<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>SoundCloud OAuth 2 User Agent Authentication Flow Demo</title>
<script type="text/javascript" charset="utf-8" src="javascript/jquery-1.4.2.js"></script>
<script type="text/javascript" charset="utf-8">
$(function () {
var extractToken = function(hash) {