I hereby claim:
- I am skatenerd on github.
- I am skatenerd (https://keybase.io/skatenerd) on keybase.
- I have a public key ASDrPaKbWuXS650wdiXEXgtej4fVbFwi8oSMyTHGyDvKAQo
To claim this, I am signing this object:
irb(main):014:0> def low(a,b) | |
irb(main):015:1> a+b | |
irb(main):016:1> end | |
=> :low | |
irb(main):017:0> def high(*args, **kwargs) | |
irb(main):018:1> low(*args, **kwargs) | |
irb(main):019:1> end | |
=> :high | |
irb(main):020:0> high(1,2) | |
=> 3 |
class Base | |
A_VALUE = 2 | |
def foo | |
raise "NOT IMPLEMENTED" | |
end | |
end | |
class Sub < Base | |
def foo |
# We all know about this Python gotcha: | |
# def foo(x=[]): | |
# x.append(1) | |
# return len(x) | |
# But the answer is not to do what ruby does. | |
# Would you expect this to run quickly or slowly? | |
def runonce | |
urls = ["yahoo.com", "google.com", "bing.com", "marxists.org"] |
import os | |
from peewee import CharField, DecimalField, IntegerField, FloatField, DateTimeField, BooleanField, TextField, CompositeKey, DateField, Model, ForeignKeyField | |
from playhouse.postgres_ext import JSONField, PostgresqlExtDatabase | |
# Add real values here... | |
database = PostgresqlExtDatabase() | |
class BaseModel(Model): | |
class Meta: |
simple = do | |
first <- pop | |
pop | |
return first | |
pop >>= (\first -> (pop >>= (\_ -> return first))) | |
I hereby claim:
To claim this, I am signing this object:
bad = -> | |
l = [] | |
for blob in blobs | |
l.push(blob) | |
go() | |
go = -> | |
blob = l.pop() | |
$.get('www.google.com/' + blob).success -> | |
cosole.log("I just requested to: " + blob) |
{-# LANGUAGE ScopedTypeVariables #-} | |
module Lib where | |
import Data.List | |
import Data.Maybe | |
import Safe | |
import Debug.Trace | |
import Data.Function | |
data Suit = Hearts | Clubs | Spades | Diamonds deriving (Eq, Show, Ord) |
module Lib (factor, intLog) where | |
import Data.Map | |
import Debug.Trace | |
divides bottom top = (mod top bottom) == 0 | |
intDivide bottom top = fst $ divMod top bottom | |
intLog base total = go base total 0 | |
where go base total count = if (divides base total) |
def weighted_average(categories): | |
total_weight = sum(weight for (weight,_) in categories) | |
sum_of_products = sum(weight * value for (weight, value) in categories) | |
return sum_of_products / total_weight | |
swing_states = { | |
'colorado': 9, | |
'florida': 29, | |
'iowa': 6, | |
'michigan': 16, |