This file contains hidden or 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 EnvironmentHelper | |
def with_environment(replacement_env) | |
original_env = ENV.to_hash | |
ENV.update(replacement_env) | |
yield | |
ensure | |
ENV.replace(original_env) | |
end | |
end |
This file contains hidden or 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
import UIKit | |
class FirstViewController: UIViewController { | |
@IBOutlet weak var nextButton: UIButton! | |
@IBAction func didTapNextButton() { | |
performSegue(withIdentifier: "moveToSecondScreen", sender: nil) | |
} | |
} |
This file contains hidden or 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 prompt_command() { | |
highlight_non_zero_exit | |
PS1="\n${yellow}$(ruby_version_prompt) ${purple}\h ${reset_color}in ${green}\w\n${bold_cyan}$(scm_char)${green}$(scm_prompt_info) ${green}→${reset_color} " | |
} | |
function highlight_non_zero_exit() { | |
PASS=$? | |
if [[ $PASS != 0 ]]; then | |
printf "${echo_bold_red}> Exit status $PASS <${echo_reset_color}\n" | |
fi |
This file contains hidden or 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
//: Playground - noun: a place where people can play | |
import UIKit | |
// Option 1 --------------------------- | |
protocol DescribeableClass { | |
static func className() -> String | |
} | |
extension DescribeableClass { |
This file contains hidden or 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
import Foundation | |
class ListDiffer<T: Equatable> { | |
private let beforeList: [T] | |
private let afterList: [T] | |
private let section: Int | |
private let elementComparison: ((T, T) -> Bool) | |
init(before: [T], after: [T], section: Int = 0, elementComparison: ((T, T) -> Bool) = { $0 == $1 }) { |
This file contains hidden or 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 | |
set -e | |
export LANG=en_US.UTF-8 | |
export LC_ALL=en_US.UTF-8 | |
# Ensure Jenkins is using rbenv | |
export PATH=/usr/local/bin:$PATH | |
if which rbenv > /dev/null; then eval "$(rbenv init -)"; fi |
This file contains hidden or 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 | |
require 'yaml' | |
CONFIG_FILE_NAME = 'brewstrap.yml' | |
COMMAND_INSTALL_CASK = 'brew install caskroom/cask/brew-cask' | |
COMMAND_BREW_UPDATE = 'brew update' | |
COMMAND_FORMULA_INSTALL = 'brew install' | |
COMMAND_BREW_TAP = 'brew tap' | |
COMMAND_BREW_CASK_INSTALL = 'brew cask install --appdir=/Applications' |
This file contains hidden or 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
# Add support for 'options' request test. Place in /spec/support | |
# https://github.com/rspec/rspec-rails/issues/925#issuecomment-62527611 | |
module ActionDispatch::Integration::RequestHelpers | |
def options(path, parameters = nil, headers_or_env = nil) | |
process :options, path, parameters, headers_or_env | |
end | |
end |
This file contains hidden or 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
before(:each) { @request.env["CONTENT_TYPE"] = "application/json" } |
This file contains hidden or 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
def iso8601_string? datetime_str | |
(datetime_str =~ /\A\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d:[0-5]\d([+-][0-2]\d:[0-5]\d|Z)\z/) == 0 | |
end |