Skip to content

Instantly share code, notes, and snippets.

View creativeaura's full-sized avatar
🌴
On vacation

Gaurav Jassal creativeaura

🌴
On vacation
View GitHub Profile
@creativeaura
creativeaura / isfloat.js
Created March 9, 2012 09:01
JavaScript isFloat and isInteger
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 10:34
Modifying Python's SimpleHTTPServer to accept directory aliases
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'],
<!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,
@creativeaura
creativeaura / styleguide.md
Last active February 12, 2018 05:17
Styleguide CSS

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;
@creativeaura
creativeaura / ReduxMicroBoilerplate.js
Created October 5, 2016 16:27 — forked from gaearon/ReduxMicroBoilerplate.js
Super minimal React + Redux app
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 10:51
NodeJS Server to serve static HTML files
{
"name" : "ServeStaticContent",
"version" : "0.0.1",
"dependencies" : {
"express" : "3.x"
}
}

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

{
"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",
pg_ctl -D /usr/local/var/postgres -l /usr/local/var/postgres/server.log start
BASE = .
build:
cd build && node build.js
.PHONY: build