Skip to content

Instantly share code, notes, and snippets.

@kblake
kblake / fizzbuzz
Created December 2, 2014 23:51
Fizz Buzz in Elixir
defmodule FizzBuzz do
def compute(n) do
s = case {rem(n, 3), rem(n, 5)} do
{0, 0} -> :FizzBuzz
{0, _} -> :Fizz
{_, 0} -> :Buzz
_ -> n
end
IO.puts(s)
end
2014-09-30 21:01:01.432+0000 INFO [o.n.s.CommunityNeoServer]: Setting startup timeout to: 120000ms based on -1
2014-09-30 21:01:01.507+0000 INFO [o.n.k.InternalAbstractGraphDatabase]: No locking implementation specified, defaulting to 'community'
2014-09-30 21:01:01.557+0000 INFO [o.n.k.i.DiagnosticsManager]: --- INITIALIZED diagnostics START ---
2014-09-30 21:01:01.558+0000 INFO [o.n.k.i.DiagnosticsManager]: Neo4j Kernel properties:
2014-09-30 21:01:01.559+0000 INFO [o.n.k.i.DiagnosticsManager]: neostore.propertystore.db.mapped_memory=1285M
2014-09-30 21:01:01.559+0000 INFO [o.n.k.i.DiagnosticsManager]: neostore.nodestore.db.mapped_memory=357M
2014-09-30 21:01:01.559+0000 INFO [o.n.k.i.DiagnosticsManager]: neostore.relationshipstore.db.mapped_memory=1575M
2014-09-30 21:01:01.559+0000 INFO [o.n.k.i.DiagnosticsManager]: neostore.propertystore.db.strings.mapped_memory=1092M
2014-09-30 21:01:01.559+0000 INFO [o.n.k.i.DiagnosticsManager]: store_dir=/Users/karmenblake/Downloads/neo4j-community-2.1.5/data/
@kblake
kblake / movies.swift
Created June 14, 2014 17:19
What if... Swinatra
get ("/movies") {
return Movie.all
}
get ("/movies/:id") {
movie = Movie.get(params["id"])
return movie
}
@kblake
kblake / 0_reuse_code.js
Created January 30, 2014 19:04
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@kblake
kblake / amrita_sample_app.ex
Last active December 19, 2015 06:49
Amrita + Elixir setup and files
# Erlang R16B
# Elixir 0.9.3
# amrita 0.1.3
# mix.exs #####################################
defmodule AmritaSandbox.Mixfile do
use Mix.Project
def project do
[ app: :amrita_sandbox,
@kblake
kblake / rules.md
Created February 4, 2013 22:43 — forked from henrik/rules.md
  1. Your class can be no longer than 100 lines of code.
  2. Your methods can be no longer than five lines of code.
  3. You can pass no more than four parameters and you can’t just make it one big hash.
  4. When a call comes into your Rails controller, you can only instantiate one object to do whatever it is that needs to be done.

You can break these rules if you can talk your pair into agreeing with you.

@kblake
kblake / mountain-lion-brew-setup.markdown
Created July 13, 2012 23:21 — forked from myobie/mountain-lion-brew-setup.markdown
Get Mountain Lion and Homebrew to Be Happy

Get Mountain Lion and Homebrew to Be Happy

1) Install XCode 4.4 into /Applications

Get it from http://developer.apple.com. You will not be able to submit apps to any stores using this XCode version, so turn away if that is something you might want to do.

2) Install Command Line Tools

In XCode's Preferences > Downloads you can install command line tools.

@kblake
kblake / postsql.sql
Created May 17, 2012 19:52 — forked from tobyhede/postsql.sql
PostgreSQL as JSON Document Store
-- PostgreSQL 9.2 beta (for the new JSON datatype)
-- You can actually use an earlier version and a TEXT type too
-- PL/V8 http://code.google.com/p/plv8js/wiki/PLV8
-- JSON Types need to be mapped into corresponding PG types
--
-- Number => INT or DOUBLE PRECISION
-- String => TEXT
@kblake
kblake / gist:1810854
Created February 12, 2012 21:08 — forked from maxim/gist:1810525
>> foo = proc { bar }
=> #<Proc:0x0000000101c444b8@(pry):1>
>> foo.call
NameError: undefined local variable or method `bar' for #<Object:0x1001dc288>
from (pry):1
>> def bar
>> "bar"
>> end
@kblake
kblake / bling.css
Created February 8, 2012 18:01
bling - your wildest imaginations come true
.bling { color: golden; border: 1px solid sparkle; }