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
{-# LANGUAGE DeriveGeneric, OverloadedStrings #-} | |
import Network.Riak | |
import Network.Riak.Connection as C | |
import Network.Socket as S | |
import System.IO.Unsafe (unsafePerformIO) | |
import Data.ByteString.Lazy.Char8 as BSL | |
import Network.Riak.JSON.Resolvable as RR | |
import Network.Riak.Types | |
import Data.Aeson |
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
require 'net/ftp' | |
ftp_root = "tgftp.nws.noaa.gov" | |
# Im running conn_test with arbitrary values for n | |
def conn_test(root, n) | |
(1..n).to_a.each do |i| | |
ftp = Net::FTP.new root | |
begin | |
ftp.passive |
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
curry = (fn)-> | |
slice = Array.prototype.slice | |
args = slice.apply arguments, [1] | |
return -> | |
fn.apply null, args.concat(slice.apply arguments) | |
levenshteinD = (s,t) -> | |
if !s.length then return t.length | |
if !t.length then return s.length |
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
require "minitest_helper" | |
describe "Root path acceptance test" do | |
before do | |
@company1 = create(:awesome_sauce_llc, featured: true) | |
@company2 = create(:better_than_you_inc, featured: true) | |
end | |
describe "when not logged in" do | |
before { visit root_path } |
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
w = 1000 | |
h = 500 | |
X = d3.scale.ordinal().domain([90]).rangePoints([0,w],1) | |
Y = d3.scale.ordinal().domain([180]).rangePoints([0,h],2) | |
upper_arc = d3.svg.arc() | |
.innerRadius(95) | |
.outerRadius(105) | |
.startAngle(0) | |
.endAngle(Math.PI) |
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
require "sugar" | |
dust = require "dust" | |
redis = require "redis" | |
client = redis.createClient() | |
clicker = (app) -> | |
client.get "clicker", (e,cr) -> | |
client.get "timed", (e,tr) -> | |
app.render index: {clicker: cr, timed: tr} |
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
class Object | |
def send_each(*methods) | |
methods.inject(self) do |o, m| | |
o.respond_to?(m) ? o.public_send(m) : o | |
end | |
end | |
end | |
class MethodSequence | |
def document_download_cells(object, name, icon_path) |
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
def create | |
# generic file specific code | |
if files = params.fetch(:flu_vaccine){{}}.fetch(:generic_files){nil} | |
@file_uploads = GenericFile.new files if files.fetch(:name) != "" | |
end | |
params.fetch(:flu_vaccine){{}}.delete :generic_files | |
# vaccine specific code | |
@vaccine = FluVaccine.new(params.fetch(:flu_vaccine){{}}) |
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
seat_index = "seat-#{arc_index}" | |
if href = SEATS[seat_index]["link"] | |
if !@links then @links = exports ? this | |
if [email protected] then @links.hash = {} | |
@links.hash[seat_index] = href | |
d3.select(".#{seat_index}").on "click", -> | |
seat_index = this.classList[1] | |
href = window.links.hash[seat_index] | |
window.open href, "_blank" |
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
use core::rand::{Rng}; | |
struct Monster { | |
name: ~str, | |
health: HealthPoints, | |
mut speed: int, | |
mut charisma: int, | |
mut max_attack: int, | |
position: Position | |
OlderNewer