Skip to content

Instantly share code, notes, and snippets.

View newtonapple's full-sized avatar

David Dai newtonapple

  • Tobiko Data
  • San Francisco
View GitHub Profile
@newtonapple
newtonapple / RankingDistances.ipynb
Created April 2, 2018 05:58 — forked from pilipolio/RankingDistances.ipynb
Experiments based on paper "Generalized distances between rankings" by Kumar and Vassilvitskii.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@newtonapple
newtonapple / job_control_zsh_bash.md
Created July 14, 2016 17:41 — forked from CMCDragonkai/job_control_zsh_bash.md
CLI: Job Control in ZSH and Bash

Job Control in ZSH and Bash

All processes in ZSH/Bash under job control are in 3 states: foregrounded, backgrounded and suspended.

# run command in the foreground
command
# run commend in the background
@newtonapple
newtonapple / gist:1062819
Created July 4, 2011 02:16 — forked from shripadk/gist:652819
Express authentication using Redis for session store and Couchdb for database (in coffeescript!)
###
Module dependencies
###
require.paths.unshift "#{__dirname}/lib/support/express-csrf/"
require.paths.unshift "#{__dirname}/lib/support/node_hash/lib/"
express = require 'express'
app = module.exports = express.createServer()
RedisStore = require 'connect-redis'
// non-id/name attributes are interpreted as cdata
// per: http://www.w3.org/TR/html4/types.html#type-cdata
var s = "<p title=\"&lt;script&gt;alert('TEST')&lt;/script&gt;\">testing 123</p>";
document.body.innerHTML = s;
document.getElementsByTagName('p')[0].getAttribute('title');
// => "<script>alert('TEST')</script>"
document.getElementsByTagName('p')[0].title;
// => "<script>alert('TEST')</script>"
require 'open-uri'
# url dsl -- the ultimate url dsl!
#
# You just can't beat this:
#
# $ irb -r url_dsl
# >> include URLDSL
# => Object
# >> http://github.com/defunkt.json
@newtonapple
newtonapple / .bash_profile
Created February 6, 2009 10:55 — forked from bcardarella/.bash_profile
Git Autocompletion
source ~/.git-completion.sh
alias gco='git co'
alias gci='git ci'