Skip to content

Instantly share code, notes, and snippets.


Samuel Reh samuelreh

View GitHub Profile
View Tail Recursion
import com.scalakata._
@instrument class Playground {
/* Tail Recursion:
* The following recursive function calculates the fibonocci number for the given index. With a large enough index,
* the program will throw a StackOverflowError.
def fib(n: Int): Int = {
View anagrams.scala
package forcomp
object Anagrams {
/** A word is simply a `String`. */
type Word = String
/** A sentence is a `List` of words. */
type Sentence = List[Word]
View gist:8a3b583fc5c10a18ffca
class Display(object):
def __init__(self):
self.array = [0x00] * (self.width() / 8) * self.height()
def height(self):
""" Get the height of the display """
samuelreh / FPinRuby.rb
Created Jan 26, 2015
Mary Rose Cook's Practical Intro to FP ported to Ruby
View FPinRuby.rb
# Squares
squares = lambda do |nums| do |num|
num * num
samuelreh /
Last active Aug 29, 2015
Refresh Materialized View Concurrently(ish) in Postgres 9.3

Refresh Materialized View Concurrently(ish) in Postgres 9.3

Recenlty at Attribution, we've been implementing materiazlied views to speed up slow queries. Although the concept is nothing new, and Materialized Views have been a feature of Oracle for years. They're a new feature in Postgres 9.3.

One missing piece in 9.3 is the ability to refresh views concurrantly, without exclusivly locking the whole view. Postgres 9.4 introduces this feature, which is great if you manage your own DB. However, those of us that use hosted database solutions, such as Amazon RDS, are not so lucky.

You can’t perform that action at this time.