Skip to content

Instantly share code, notes, and snippets.

View chiragchamoli's full-sized avatar

Chirag Chamoli chiragchamoli

View GitHub Profile
@chiragchamoli
chiragchamoli / Vim Cheat Sheet
Created September 6, 2012 16:55
Vim Cheat Sheet
Primary Commands
d delete
y copy
c change
r replace
p paste
u undo
a append
o new line
x delete char
@chiragchamoli
chiragchamoli / jQuery in Action
Created September 6, 2012 16:58
jQuery in Action
(from jQuery in Action)
Basic CSS selectors
* - any element
E - elements with tag E
E F - elements with tag F that are descendants of E
E>F - elements with tag F that are direct children of E
E+F - elements F immediately preceded by sibling E
E~F - elements F preceded by any sibling E
@chiragchamoli
chiragchamoli / http status code
Created September 6, 2012 16:59
http status code
1xx Informational
100: Continue (:continue)
101: Switching Protocols (:switching_protocols)
102: Processing (:processing)
2xx Success
200: OK (:ok)
201: Created (:created)
202: Accepted (:accepted)
203: Non-Authoritative Information (:non_authoritative_information)
@chiragchamoli
chiragchamoli / gist:3754597
Created September 20, 2012 08:09
Example of 1NF, 2NF and 3NF in plain english?

1NF is the most basic of normal forms - each cell in a table must contain only one piece of information, and there can be no duplicate rows.

2NF and 3NF are all about being dependent on the primary key. Recall that a primary key can be made up of multiple columns. As Chris said in his response:

The data depends on the key [1NF], the whole key [2NF] and nothing but the key [3NF] (so help me [Codd][1]).

2NF

Say you have a table containing courses that are taken in a certain semester, and you have the following data:

{"Banashankari" , "Bannerghatta" , "Basavanagudi" , "Bellandur" , "Brigade Road" , "BTM" , "City Market" , "Commercial Street" , "Cunningham Road" , "CV Raman Nagar" , "Domlur" , "Electronic City" , "Frazer Town" , "Frazer Town" , "HBR Layout" , "Hebbal" , "Hennur" , "HSR" , "Indiranagar" , "Infantry Road" , "International Airport" , "Jakkur" , "Jalahalli" , "Jayanagar" , "JP Nagar" , "Kaggadasapura" , "Kalyan Nagar" , "Kammanahalli" , "Kengeri" , "Koramangala" , "KR Puram" , "Kumaraswamy Layout" , "Langford Town" , "Lavelle Road" , "Magadi Road" , "Majestic" , "Malleshwaram" , "Marathahalli" , "MG Road" , "Mysore Road" , "Nagarbhavi" , "Nagawara" , "New BEL Road" , "Old Airport Road" , "Old Madras Road" , "Peenya" , "Puttenahalli" , "Race Course Road" , "Rajarajeshwari Nagar" , "Residency Road" , "Richards Town" , "Richmond Road" , "Richmond Town" , "Sadashiv Nagar" , "Sanjay Nagar" , "Sankey Road" , "Sarjapur Road" , "Seshadripuram" , "Shanti Nagar" , "Shivajinagar" , "Thippasandra" , "Ulsoor" , "Vijay Naga
@chiragchamoli
chiragchamoli / gist:3801100
Created September 28, 2012 17:20
What is Lambda

Functions without a name

Simply put, a lambda is a function without a name, or an anonymous function. A small piece of executable code, that can be passed around as if it were a variable. In JavaScript:

function () {}; // very simple

Let's see now some uses for these lambdas.

Abstracting boilerplate code

Lambdas may be used to abstract away boilerplate code. For example loops. We're used to write for and while loops all day long. But this is code that does not be written. We could extract the code inside the loop, the most important part of the loop, and abstract away the rest:

@chiragchamoli
chiragchamoli / gist:3825673
Created October 3, 2012 07:52
Google Groups of India
android-group-iit-bombay@googlegroups.com,
occ-kolkata@googlegroups.com,
occdelhi@googlegroups.com,
mumbai-startup@googlegroups.com,
mrug@googlegroups.com,
hydstartups@googlegroups.com,
pune-cloudcomputing@googlegroups.com,
eventsbangalore@googlegroups.com,
thoughtworks-bangalore-geek-nights@googlegroups.com,
nen-eclub-pune@googlegroups.com,
DropBox YC Application
http://dl.dropbox.com/u/27532820/app.html
Reddit YC Application
http://alexisohanian.com/our-y-combinator-summer-05-application-what-w
FamilyLeaf YC Application
http://dl.dropbox.com/u/19699329/FamilyLeaf_YC_application.pdf
[
{
"id":0,
"tag_name":".htaccess"
},
{
"id":1,
"tag_name":".htaccess"
},
{
@chiragchamoli
chiragchamoli / functions.php
Created October 4, 2012 14:12 — forked from johndugan/functions.php
WordPress: functions.php boilerplate
// ---------------------------------------------------------
// ---------- WordPress functions.php boilerplate ----------
// ---------------------------------------------------------
<?php
// ----------------------------------------------------------------------------
// ---------- Translations can be filed in the /languages/ directory ----------
// ----------------------------------------------------------------------------
load_theme_textdomain( 'html5reset', TEMPLATEPATH . '/languages' );