Skip to content

Instantly share code, notes, and snippets.

View backbone_pushstate_router.js
// Use absolute URLs to navigate to anything not in your Router.
// Only need this for pushState enabled browsers
if (Backbone.history && Backbone.history._hasPushState) {
// Use delegation to avoid initial DOM selection and allow all matching elements to bubble
$(document).delegate("a", "click", function(evt) {
// Get the anchor href and protcol
var href = $(this).attr("href");
var protocol = this.protocol + "//";
sayar / server.js
Created Mar 22, 2015
Hands-on: Build a Node.js-powered chatroom web app | Part 1: Introduction to Node.js
View server.js
var http = require('http');
var port = process.env.port || 1337;
http.createServer(function (req, res) {
res.writeHead(200, { 'Content-Type': 'text/plain' });
res.end('Hello World\n');
sayar / app.js
Last active Aug 29, 2015
FITC - What's New in ES6 for Web Devs - Sample code from my presentation
View app.js
'use strict';
// app.js
import * as math from "math";
alert("2π = " + math.add(math.pi, math.pi));
sayar / memory_leak.html
Created Sep 16, 2015
FITC - Advanced JavaScript Debugging
View memory_leak.html
<!DOCTYPE html>
<html lang="en">
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Memory Leak</title>
<meta name="author" content="@ramisayar">
<link href="" rel="stylesheet" integrity="sha256-MfvZlkHCEqatNoGiOXveE8FIwMzZg4W85qfrfIFBfYc= sha512-dTfge/zgoMYpP7QbHy4gWMEGsbsdZeCXz7irItjcC3sPUFtf0kuFbDz/ixG7ArTxmDjLXDmezHubeNikyKGVyQ==" crossorigin="anonymous">
View gist:5832606
var wp = require('wporg');
var client = wp.createClient({
username: "username",
password: "password",
url: ""
client.getUsersBlogs(function(err, data){