Skip to content

Instantly share code, notes, and snippets.

View fizerkhan's full-sized avatar

Fizer Khan (பைசர் கான்) fizerkhan

View GitHub Profile
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>JS Bin</title>
<div class="steps">
<a href="" class="step step1">1</a>
<div class="line line1"></div>
<a href="" class="step step2">2</a>
<div class="line line2"></div>
@renajohn
renajohn / dateFormatter.js
Created October 26, 2011 07:11
Handlebar date formatter helper
/**
* Date formatting helper.
*
* Date helper takes a SC.DateTime and return a formatted string based on the format
* parameter. If no format is given, it uses %c as default.
*
* @param format a format string
*/
Handlebars.registerHelper('date', function(path, block) {
if (path) {
@fizerkhan
fizerkhan / gist:2364466
Created April 12, 2012 03:37
I'd like to double click this td element and have #heythere toggle too
HTML
----
<table class="table table-striped">
<tbody>
<tr class="diary_hour"><!-- Hour Row Start -->
<td class="span1" data-toggle="collapse" data-target="#heythere" title="Got a question? Drop us a line.">
<h4>Click Here</h4>
</td>
<td class="test"> <!-- I'd like to double click this td element and have #heythere toggle too -->
@diurnalist
diurnalist / gist:2364707
Created April 12, 2012 05:06
Lightweight Relation Modeling with Backbone (6)
var Track = Backbone.Model.extend(),
TrackList = Backbone.Collection.extend({
model: Track
}),
Album = Backbone.RelationalModel.extend({
relations: {
trackList: TrackList
}
});​
@ruturajv
ruturajv / beacon.js
Created April 25, 2012 04:28
node.js web beacon (web bug) serving
http = require('http');
url = require('url');
http.createServer(function(req, res){
var requestURL = url.parse(req.url, true)['pathname'];
if (requestURL == '/log.gif') {
var imgHex = '47494638396101000100800000dbdfef00000021f90401000000002c00000000010001000002024401003b';
var imgBinary = new Buffer(imgHex, 'hex');
res.writeHead(200, {'Content-Type': 'image/gif' });
@danbronsema
danbronsema / responsivemenu.css
Created May 3, 2012 11:02
CSS - Responsive Menu in Bootstrap
@media (max-width: 979px) {
body {
padding-top: 0;
}
.navbar-fixed-top {
position: static;
margin-bottom: 18px;
}
.navbar-fixed-top .navbar-inner {
padding: 5px;
@otanistudio
otanistudio / chat-frontend.js
Created June 2, 2012 04:45 — forked from martinsik/chat-frontend.js
Node.js chat server, with the frontend changed to use BackboneJS
/*global $, Backbone, window, console, WebSocket, _ */
$(function () {
"use strict";
// for better performance - to avoid searching in DOM
var $content = $('#content')
, $input = $('#input')
, $status = $('#status')
// my color assigned by the server
@OpenGrid
OpenGrid / twitter-bootstrap-forms-responsive.css
Created July 24, 2012 15:19
Twitter Bootstrap form-horizontal css for form for two column layout
@media (max-width: 980px) {
.form-horizontal .control-group > label {
float: none;
width: auto;
padding-top: 0;
text-align: left;
}
.form-horizontal .controls {
margin-left: 0;
}
@jonotron
jonotron / backbone.dualstorage.relational.js
Created July 24, 2012 21:43
Recursively create UUIDs on Backbone.RelationalModels when saving via Backbone.Dualstorage
var _create = window.Store.prototype.create; // reference to original create
/**
* Create a slightly more compliant UUID generator
* credit: http://stackoverflow.com/posts/2117523/revisions
*
* @returns generated UUID
*/
var generateId = window.Store.prototype.generateId = function() {
return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function(c) {
@fizerkhan
fizerkhan / server.js
Created August 10, 2012 05:56 — forked from marfalkov/server.js
Using winston-mongodb with a scalable nodejs application on OpenShift
#!/bin/env node
// OpenShift sample Node application
var winston = require('winston');
var MongoDB = require('winston-mongodb').MongoDB;
winston.add(MongoDB, {
db: process.env.OPENSHIFT_APP_NAME
, host: process.env.OPENSHIFT_NOSQL_DB_HOST
, port: parseInt(process.env.OPENSHIFT_NOSQL_DB_PORT, 10)