Skip to content

Instantly share code, notes, and snippets.

Avatar
🌴
On vacation

Gaurav Jassal creativeaura

🌴
On vacation
View GitHub Profile
@creativeaura
creativeaura / isfloat.js
Created Mar 9, 2012
JavaScript isFloat and isInteger
View isfloat.js
function isFloat(n){
return n === +n && n !== (n|0);
}
function isInteger(n){
return n === +n && n === (n|0);
}
@creativeaura
creativeaura / server.py
Created May 9, 2013
Modifying Python's SimpleHTTPServer to accept directory aliases
View server.py
import os
import posixpath
import urllib
import BaseHTTPServer
from SimpleHTTPServer import SimpleHTTPRequestHandler
# modify this to add additional routes
ROUTES = (
# [url_prefix , directory_path]
['/media', '/var/www/media'],
View index.html
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>JS Bin</title>
<script src="https://cdnjs.cloudflare.com/ajax/libs/knockout/3.3.0/knockout-min.js"></script>
<style id="jsbin-css">
body,
View styleguide.md

Styleguide

Coding style

80 Characters Wide

Where possible, limit CSS files width to 80 characters. Reasons for this include

  • the ability to have multiple files open side by side;
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
// ------------
@creativeaura
creativeaura / package.json
Created May 9, 2013
NodeJS Server to serve static HTML files
View package.json
{
"name" : "ServeStaticContent",
"version" : "0.0.1",
"dependencies" : {
"express" : "3.x"
}
}
View pubsub.md

#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 http://msdn.microsoft.com/en-us/scriptjunkie/hh201955.aspx)

##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:

View sublime_settings
{
"auto_complete": true,
"auto_complete_delay": 0,
"bold_folder_labels": false,
"caret_style": "wide",
"color_scheme": "Packages/Color Scheme - Default/iPlastic.tmTheme",
"detect_slow_plugins": false,
"dictionary": "Packages/Language - English/en_GB.dic",
"draw_indentbundle install_guides": true,
"draw_white_space": "all",
View new_gist_file
pg_ctl -D /usr/local/var/postgres -l /usr/local/var/postgres/server.log start
View Makefile
BASE = .
build:
cd build && node build.js
.PHONY: build