This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
=Navigating= | |
visit('/projects') | |
visit(post_comments_path(post)) | |
=Clicking links and buttons= | |
click_link('id-of-link') | |
click_link('Link Text') | |
click_button('Save') | |
click('Link Text') # Click either a link or a button | |
click('Button Value') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# Via http://tbaggery.com/2011/02/07/bundle-while-you-git.html | |
# Save as http://.git/hooks/post-checkout in your project and `chmod +x` | |
# See the post for how to tell Git you want this in new/newly cloned repos | |
if [ $1 = 0000000000000000000000000000000000000000 ]; then | |
# Special case for initial clone: compare to empty directory. | |
old=4b825dc642cb6eb9a060e54bf8d69288fbee4904 | |
else |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
# A simply utility to show character counts for each line of input and | |
# highlight lines longer than 80 characters. | |
# | |
# Written as an example for http://jstorimer.com/2011/12/12/writing-ruby-scripts-that-respect-pipelines.html | |
# | |
# Examples: | |
# | |
# $ hilong Gemfile |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
web: ruby serve.rb $PORT |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Weighted Moving Average (WMA) | |
# http://en.wikipedia.org/wiki/Moving_average#Weighted_moving_average | |
# | |
# Given a hash, calculates the weighted moving averages of its values within | |
# a window size given. Modifies the original hash values. | |
# | |
# @param hash [Hash] the hash for whom values calculate the weighted moving | |
# averages. | |
# @param maws [Fixnum] the Moving Average Window Size. The greatest this | |
# number is the smoothest the calculated averages will be. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module ArrayMatching | |
class ArrayMatching | |
def initialize(array) | |
@array = array | |
end | |
def ==(other_array) | |
Set.new(@array) == Set.new(other_array) | |
end |
The Nix store is an immutable file tree store, addressed by output hashes ($outhash-$name
or $out
), but could also be tweaked to be addressed by the content hash of the file tree ($cas
).
Git is a content-addressed immutable object store. It is optimized for storing files as blobs and directories as tree objects.
Here we consider using a git repository for deduplicating, compressing and distributing the Nix store. We want to achieve maximum deduplication so we extract small changes from files before storing, so they become more similar.