This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
git config --global alias.rdiff '!g() { origin=$(git config --get remote.origin.url | sed "s/git@/https:\/\//g" | sed "s/.com:/.com\//g"); url=${origin/.git/\/commit\/$(git rev-parse HEAD)}; open $url; }; g' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /usr/bin/python | |
# -*- coding: utf-8 -*- | |
import feedparser | |
import urllib2 | |
def downloadFileProgressBar(url): | |
file_name = url.split('/')[-1] | |
u = urllib2.urlopen(url) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* line {x,y,dx,dy} */ | |
var points = [{x:1,y:1},{x:2,y:2},{x:1,y:2},{x:1,y:3},{x:1,y:4}]; | |
var maxNumberOfPoints = 1; | |
points.forEach(function(pointA) { | |
var numberOfPointsA = 1; | |
var atan = Math.atan2(pointA.y, pointA.x); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var myObj = {}; | |
var populateObj = function(obj) { for(var i = 0; i < 10000; i++) { if(i%5==0)obj[i] = i; } }; | |
//populateObj(myObj); | |
console.time('test-and-assign'); | |
for(var i = 0; i < 10000; i++) { | |
if(!myObj[i]){ | |
myObj[i] = i; | |
} | |
} | |
console.timeEnd('test-and-assign'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var mongoose = require("mongoose"); | |
var ObjectId = mongoose.Schema.Types.ObjectId; | |
//create schema for a post | |
var PostSchema = new mongoose.Schema({ | |
nonce: ObjectId, //this is used for protecting against concurrent edits: http://docs.mongodb.org/ecosystem/use-cases/metadata-and-asset-management/ | |
name: String, | |
dateCreated: { type: Date, default: Date.now }, | |
dateLastChanged: { type: Date, default: Date.now }, | |
postData: mongoose.Schema.Types.Mixed |