Skip to content

Instantly share code, notes, and snippets.

View freshtonic's full-sized avatar
🎯

James Sadler freshtonic

🎯
  • Sydney, Australia
View GitHub Profile
# The Ruby version
VBUCKET_COUNT = 4096
def keyToVBucket(key)
b = 27183
a = 31415
vbucket = 0
(0...key.length).each do |i|
vbucket = (a * vbucket + key[i]) % VBUCKET_COUNT
class Foo
constructor: (id) ->
@id: id
instanceMethod: ->
alert("instanceMethod was called on instance ${@id}")
f1: new Foo("toot")
f2: new Foo("woot")
class Animal
move: (meters) ->
alert @name + " moved " + meters + "m."
class Snake extends Animal
constructor: (name) ->
@name: name
animal: new Snake("Slithery")
animal.move(30)
#!/usr/bin/env ruby
require 'trollop'
require 'em-http'
require 'sha1'
require 'ruby-debug'
# Event driven Dynamo Server Benchmarker
class DynamoBenchmarker
http://github.com/creationix/step
http://github.com/creationix/do
http://github.com/creationix/conductor
http://github.com/kriszyp/node-promise
http://github.com/weaver/begin.js
W: node: copyright-lists-upstream-authors-with-dh_make-boilerplate
W: node: copyright-has-url-from-dh_make-boilerplate
W: node: copyright-contains-dh_make-todo-boilerplate
E: node: description-starts-with-package-name
W: node: description-starts-with-leading-spaces
W: node: new-package-should-close-itp-bug
# foo.coffee
kiwi: require('kiwi')
kiwi.require('ext') # The magic line. Commented-out everything works as it should; left in you get an exception (see below)
require('./bar')
# bar.coffee
sys: require('sys')
#!/usr/bin/env coffee
class Base
someMethod: ->
sys.puts "hello from Base"
class Derived
someOtherMethod: ->
someMethod() # error: method doesn't exist
%p
Blah blah blah blah
%a(href='#foo') foo
and
%a(href='#bar') bar
\.
-# The problem with the above Haml fragment is that I am left with a space after <a href='#bar'>bar</a> and before the period.
-# Haml's whitespace removal does not resolve the issue, because it can either remove ALL whitespace
-# around an element or ALL whitespace within an element. Neither option seems to fit the bill.
http://skitch.com/railsninja/n4xi5/job-futures
Above Url is the interface for the numbers I am trying to pull, Fuck me I have no idea how to try and explain this simply, we have been mindfucking this here for ages
1. Is from a table called placement_scores which needs to have numbers from the latest month, period_ending field (date)
2. Is also from a table placement_scores but needs to aggregate numbers from the 3 months prior to the latest month
3. Is from a table called outcome_scores which needs to aggregate numbers from between 7 months and 5 months prior using a period_ending value as well
It looks like 3 separate queries UNIONed together to me, like this:
select "Placement targets achieved in #{month_year}", count(*) from placement_scores where ....