Skip to content

Instantly share code, notes, and snippets.

View bbuckley's full-sized avatar

Brian K. Buckley bbuckley

View GitHub Profile
@bbuckley
bbuckley / Main.elm
Created October 2, 2017 01:49 — forked from anonymous/Main.elm
pipeline
module Main exposing (main)
import Html exposing (Html, text)
import Ordering exposing (..)
a : List Int
a =
[ 2, 28, 6, 34, -9 ]
@gorangajic
gorangajic / es6-spread-immutable-cheatsheet.md
Last active April 11, 2024 08:32
es6 spread immutable cheatsheet

update object

var state = {
    id: 1,
    points: 100,
    name: "Goran"
};

var newState = {
describe "named scope" do
describe "#similar_to" do
let(:category) { Factory.create(:category) }
let(:product) {
Factory.create(
:product, :categories => [category]
)
@bulters
bulters / Git Unstage file
Created June 30, 2010 09:07
Git alias for 'unstaging' changes
git config --global alias.unstage='reset HEAD --'
@defunkt
defunkt / range.rb
Created November 24, 2009 21:17
Mustache method_missing hack
require 'mustache'
class Ranger < Mustache
self.template = <<-template
{{#range_0_to_10}}
<option value="{{i}}">{{i}}</option>
{{/range_0_to_10}}
template
def range(first, last)
@rklemme
rklemme / album.rb
Created October 24, 2009 17:58
Complete file for blog entry "The Complete Class"
require 'yaml'
Track = Struct.new :title, :duration
# An Album represents an audio medium which has title,
# interpret, a pause duration between tracks and a list
# of individual tracks.
class Album
attr_reader :title, :interpret, :pause