Skip to content

Instantly share code, notes, and snippets.

Josh Cutler joshcutler

Block or report user

Report or block joshcutler

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View keybase.md

Keybase proof

I hereby claim:

  • I am joshcutler on github.
  • I am josh_cutler (https://keybase.io/josh_cutler) on keybase.
  • I have a public key ASCSrd4wWnjKO-7mDK2oifqvcHYZvYvnroCGAmbVZJ9G_Qo

To claim this, I am signing this object:

@joshcutler
joshcutler / Event Manager
Last active Dec 31, 2015
Event based JS on page load for rails App
View Event Manager
if typeof(Object.create) != 'function'
Object.create = (o) ->
F = () -> { }
F.prototype = o
return new F()
fromPrototype = (prototype, object) ->
newObject = Object.create(prototype)
`for(prop in object)
{
@joshcutler
joshcutler / gist:6716983
Last active Dec 24, 2015
Filter out Political Theory emails
View gist:6716983
(subject:(Theory) arendt OR rawls -micro -microeconomic -to:cs-econ)
@joshcutler
joshcutler / linenumbers.css
Created Nov 1, 2012
CSS to add line numbers to embedded gists
View linenumbers.css
.gist .highlight {
border-left: 3ex solid #eee;
position: relative;
}
.gist .highlight pre {
counter-reset: linenumbers;
}
.gist .highlight pre div:before {
@joshcutler
joshcutler / gist:3157465
Created Jul 21, 2012
create a user in postgres
View gist:3157465
sudo -u postgres createuser <username>
@joshcutler
joshcutler / git log alias
Created Jun 19, 2012
Prettier git logs
View git log alias
git config --global alias.lg "log --color --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit"
@joshcutler
joshcutler / gist:2769323
Created May 22, 2012
Sample From a large file (by line)
View gist:2769323
perl -ne 'print if (rand() < .01)' large_input_file.txt > sampled_output.txt
@joshcutler
joshcutler / rookexample.R
Created Dec 30, 2011
Simple Rook Example
View rookexample.R
require('Rook')
library(Rook)
library(rjson)
rook = Rhttpd$new()
rook$add(
name ="summarize",
app = function(env) {
req = Rook::Request$new(env)
@joshcutler
joshcutler / rookonheroku.sh
Created Dec 19, 2011
Setup Rook on heroku
View rookonheroku.sh
mkdir rookonheroku
cd rookonheroku
mkdir bin
echo "puts 'OK'" > config.ru
echo "source 'http://rubygems.org'\n gem 'rack'" &gt; Gemfile
bundle install
git init .
git add .
@joshcutler
joshcutler / gist:1363069
Created Nov 14, 2011
Use case of Classyfier
View gist:1363069
require 'classyfier'
@classyfier = Classyfier::NaiveBayes::NaiveBayesClassifier.new
@classyfier.train({:subject => 'Must read!', :text => 'Get Viagra cheap!'}, :spam)
@classyfier.train({:subject => 'Gotta see this', :text => 'Viagra. You can get it at cut rates'}, :spam)
@classyfier.train({:subject => 'Call me tomorrow', :text => 'We need to talk about scheduling. Call me.'}, :not_spam)
@classyfier.train({:subject => 'That was hilarious', :text => 'Just saw that link you sent me'}, :not_spam)
@classyfier.train({:subject => 'dinner at 7', :text => 'I got us a reservation tomorrow at 7'}, :not_spam)
@scores = @classyfier.classify({:subject => 'See it to believe it', :text => 'Best rates you\'ll see'})
You can’t perform that action at this time.