Skip to content

Instantly share code, notes, and snippets.

On vacation

Gaurav Jassal creativeaura

On vacation
View GitHub Profile
View ReduxMicroBoilerplate.js
import React, { Component } from 'react';
import { createStore, combineReducers, applyMiddleware, bindActionCreators } from 'redux';
import { provide, connect } from 'react-redux';
import thunk from 'redux-thunk';
const AVAILABLE_SUBREDDITS = ['apple', 'pics'];
// ------------
// reducers
// ------------
View gist:f7dee2979fb9da6b8c1f
alias server='open http://localhost:8000 && python -m SimpleHTTPServer'
View MainViewController.h
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
View supplant.js
* supplant() does variable substitution on the string. It scans through the string looking for
* expressions enclosed in { } braces. If an expression is found, use it as a key on the object,
* and if the key has a string value or number value, it is substituted for the bracket expression
* and it repeats.
* Written by Douglas Crockford
String.prototype.supplant = function (o) {

#Four Ways To Do Pub/Sub With jQuery and jQuery UI (in the future)

Between jQuery 1.7 and some of work going into future versions of jQuery UI, there are a ton of hot new ways for you to get your publish/subscribe on. Here are just four of them, three of which are new.

(PS: If you're unfamiliar with pub/sub, read the guide to it that Julian Aubourg and I wrote here

##Option 1: Using jQuery 1.7's $.Callbacks() feature:

$.Callbacks are a multi-purpose callbacks list object which can be used as a base layer to build new functionality including simple publish/subscribe systems. We haven't yet released the API documentation for this feature just yet, but for more information on it (including lots of examples), see my post on $.Callbacks() here:

# Start an HTTP server from a directory, optionally specifying the port
function server() {
# Default to port 8000
local port="${1:-8000}"
# Since the one-liner blocks, we open the browser beforehand. However, we want to
# wait just a couple of seconds since the server will not be ready just yet.
# Also, I think Linux users should be able to use 'xdg-open' ('open' is for OS X).
( sleep 2; open "http://localhost:${port}/" ) &
creativeaura / web-app.html
Created Dec 4, 2012 — forked from tfausak/ios-8-web-app.html
iOS web app icons & startup images
View web-app.html
<!doctype html>
<meta charset="utf-8">
<meta content="yes" name="apple-mobile-web-app-capable">
<!-- iPhone -->
<link href=""
creativeaura / linkify.js
Created Nov 6, 2012 — forked from briancray/linkify.js
Linkify Twitter API entities
View linkify.js
Compliant with Twitter's Developer Display Requirements:
var linkify_result = function (tweet /* tweet object from the results array */) {
var subs = [],
last_offset = 0,
new_tweet = '',
replace = {