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
describe "#mentions_story?" do | |
subject { described_class.new(file) } | |
let(:file) { "COMMIT_EDITMSG" } | |
before do | |
File.stub(:read).with(file) { example_commit_message(@relevant_part) } | |
end | |
context "commit message contains the special Pivotal Tracker story syntax" do | |
it "matches just the number" do | |
@relevant_part = "[#8675309]" |
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
# what? why does your production code care what environment it is in? SILLY! | |
unless Rails.development? || Rails.test? | |
Slottd::CreatesReservationTimer.for(slot.id) | |
end |
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
defmodule FolditTest do | |
use ExUnit.Case | |
doctest Foldit | |
def to_keyword([], keyword), do: keyword | |
def to_keyword([val], keyword) do | |
Keyword.update(keyword, nil, [val], fn existing -> [val | existing] end) | |
end |
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 | |
# Usage ruby 2-minute-timer.rb "message to say when time is up" | |
# or just chmod +x timer.rb and ./timer.rb | |
# for more info, see http://coderetreat.org/profiles/blogs/new-session-idea-baby-steps | |
message = ARGV[0] || "times up" | |
minutes = 2 | |
seconds = minutes*60 | |
while(true) |
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
type Id | |
= Id Int | |
idIs : Id -> { a | id : Id } -> Bool | |
idIs thisId = | |
idFieldIs .id thisId | |
idFieldIs : (a -> Id) -> Id -> a -> Bool |
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 Animation exposing (..) | |
import Task | |
import Process | |
import Time exposing (Time, millisecond) | |
type Animation state | |
= Setup state | |
| Animate state |
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 Shared.UserAlert exposing (UserAlert, Msg, show, startShowAlertAnimation, startHideAlertAnimation, default, update, view) | |
import Helpers exposing (classes) | |
import Shared.Animation as Animation | |
import Html exposing (Html, div, span, text) | |
import Html.Attributes exposing (class) | |
import Task | |
type UserAlert |
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
-- support stuff for remote stuff | |
type alias ErrorMessages = | |
Dict.Dict String (List String) | |
type alias ApiError = | |
{ message : String | |
, errors : ErrorMessages | |
, explanation : Maybe String | |
} |
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
namespace :elm do | |
Apps = [ "WorkspaceMain", "ManageSubscribersMain", "NotebookMain", "ResponsesMain" ] | |
JsFileName = "irn_elm.js" | |
JsOutputDir = "app/assets/javascripts" | |
desc "Updates packages, compiles the Elm code and copies it to #{JsOutputDir}" | |
task :compile_and_copy => [:package_install, :make, :copy] do | |
puts "Updated Packages, Compiled and copied Elm code to #{JsOutputDir}" | |
end |
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
function directory_to_titlebar { | |
local pwd_length=42 # The maximum length we want (seems to fit nicely | |
# in a default length Terminal title bar). | |
# Get the current working directory. We'll format it in $dir. | |
local dir="$PWD" | |
# Substitute a leading path that's in $HOME for "~" | |
if [[ "$HOME" == ${dir:0:${#HOME}} ]] ; then | |
dir="~${dir:${#HOME}}" | |
fi |