Skip to content

Instantly share code, notes, and snippets.

Jason Dew jasondew

Block or report user

Report or block jasondew

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 quine.rb
puts 'require "quine"'
module Kernel
def method_missing name, *args
print name
metaclass = class << (o =; self; end
metaclass.send(:define_method, :method_missing) do |name, *args|
print ".#{name}"
View echo.rb
require "quine"
View simple_linear_regression.rb
x_bar = xs.sum / xs.length.to_f
y_bar = ys.sum / ys.length.to_f
normalized_xs = {|x| x - x_bar }
normalized_ys = {|y| y - y_bar }
beta_hat = {|x, y| x*y }.sum / normalized_xs.inject(0) {|sum, x| sum + x*x }
alpha_hat = y_bar - beta_hat * x_bar
[[0, alpha_hat], [xs.last, (alpha_hat + xs.last * beta_hat)]]
jasondew / foo.rb
Created Aug 8, 2011 — forked from gfredericks/foo.rb
kimian quine
View foo.rb
foo.rb:1: syntax error, unexpected tINTEGER, expecting tSTRING_CONTENT or tSTRING_DBEG or tSTRING_DVAR or tSTRING_END
foo.rb:1: syntax error, unexpected tI...
jasondew / conway-twitter.rb
Created May 17, 2012
My current best try at a twitter-length implementation of Conway's Game of Life for #roguesgolf
View conway-twitter.rb
l==3||b[x][y]&&l==2}}{|r|puts{|c|c ??#:?.}*""}}
jasondew / gist:5050066
Last active Apr 8, 2018
Luhn Checksum project
View gist:5050066
Luhn Checksum
Implement a Ruby program that outputs the validity of a number by applying the Luhn Checksum.
The program should accept a single number to validate.
jasondew / gist:5555730
Created May 10, 2013
invalid authenticity token bug in rails 4
View gist:5555730
>> form_authenticity_token
=> "OBVOzqfizcWJ+d6GrYFO8NvZQMKlOji5vu28iwwED68="
>> params[:authenticity_token]
=> "OBVOzqfizcWJ d6GrYFO8NvZQMKlOji5vu28iwwED68="
View das_download.rb
#! /usr/bin/env ruby
# usage:
# $ das_download.rb email password [download_directory]
require "mechanize"
class DasDownloader
attr_reader :agent, :email, :password
def initialize(email, password)
jasondew /
Created Jul 9, 2013
Java vs Ruby vs Scala
public class Account implements Serializable {
private String subdomain;
public String getSubdomain() {
return subdomain;
public void setSubdomain(String subdomain) {
this.subdomain = subdomain;

Keybase proof

I hereby claim:

  • I am jasondew on github.
  • I am jasondew ( on keybase.
  • I have a public key whose fingerprint is D4FD 83C6 D891 37EC 3045 8745 3581 0583 7D91 64D9

To claim this, I am signing this object:

You can’t perform that action at this time.