I hereby claim:
- I am jasondew on github.
- I am jasondew (https://keybase.io/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:
puts 'require "quine"' | |
module Kernel | |
def method_missing name, *args | |
print name | |
metaclass = class << (o = Object.new); self; end | |
metaclass.send(:define_method, :method_missing) do |name, *args| | |
print ".#{name}" | |
self | |
end |
require "quine" | |
this.that.and.something_else |
x_bar = xs.sum / xs.length.to_f | |
y_bar = ys.sum / ys.length.to_f | |
normalized_xs = xs.map {|x| x - x_bar } | |
normalized_ys = ys.map {|y| y - y_bar } | |
beta_hat = normalized_xs.zip(normalized_ys).map {|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)]] |
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... | |
^ |
n=(0..3);g=[!1]*4;b=[g,g,[!1]+[1]*3,g] | |
4.times{b=n.map{|x|n.map{|y|l=[x-1,x+1,x].product([y-1,y+1,y])[0..7].select{|f,g|(r=b[f])&&r[g]}.size | |
l==3||b[x][y]&&l==2}} | |
b.map{|r|puts r.map{|c|c ??#:?.}*""}} |
Luhn Checksum | |
http://en.wikipedia.org/wiki/Luhn_algorithm | |
Implement a Ruby program that outputs the validity of a number by applying the Luhn Checksum. | |
Input: | |
The program should accept a single number to validate. | |
Output: |
>> form_authenticity_token | |
=> "OBVOzqfizcWJ+d6GrYFO8NvZQMKlOji5vu28iwwED68=" | |
>> params[:authenticity_token] | |
=> "OBVOzqfizcWJ d6GrYFO8NvZQMKlOji5vu28iwwED68=" |
#! /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) |
public class Account implements Serializable { | |
private String subdomain; | |
public String getSubdomain() { | |
return subdomain; | |
} | |
public void setSubdomain(String subdomain) { | |
this.subdomain = subdomain; | |
} |
I hereby claim:
To claim this, I am signing this object: