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 alphabet (map #(str (char %)) (range (int \A) (inc (int \Z))))) | |
(defn outside-spaces | |
[letter letters] | |
(loop [[current-letter & rest] letters | |
position 0] | |
(if (= current-letter letter) | |
position | |
(recur rest (inc position))))) |
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
@interface VariableNoBrackets : NSObject | |
@end | |
@implementation VariableNoBrackets | |
NSString *aString; | |
- (instancetype)initWithString: (NSString *)newString { | |
self = [super init]; | |
if (self) { | |
aString = newString; | |
} |
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
(defn say-hello [] | |
(println "Please type your name:") | |
(let [name (read)] | |
(println "Nice to meet you, " name))) | |
(def hello "123") | |
(println "blah blah") | |
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
(ns wizard) | |
(def nodes {:living-room "You are in the living room. A wizard is snoring loudly on the couch. " | |
:garden "You are in a beautiful garden. There is a well in front of you. " | |
:attic "You are in the attic. There is a giant welding torch in the corner. "}) | |
;(nodes :living-room) | |
(defn describe-location [loc node-list] | |
(loc node-list)) |
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
(and (odd? 5) (odd? 7)) | |
(or (odd? 4) (odd? 7)) | |
(def *is-it-even* (atom nil)) | |
(or (odd? 4) (reset! *is-it-even* true)) | |
@*is-it-even* |
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
;; cell | |
[1 2] | |
;; world | |
#{ [1 0] [1 1] [1 2]} | |
;; compute neighbors of a cell | |
(defn neighbors [[x y]] | |
(for [dx [-1 0 1] | |
dy (if (zero? dx) |
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 | |
workspace_name = %x[ls].split.find{ |file_name| file_name.include? 'xcworkspace' } | |
project_name = workspace_name.split('.')[0] | |
pwd = %x[pwd].strip | |
settings = %x[xcodebuild -workspace #{workspace_name} -showBuildSettings -scheme #{project_name}] | |
%x[xcodebuild -workspace #{workspace_name} test -scheme #{project_name} -destination OS=6.1,name=iPad -configuration Debug] | |
if $? == 0 | |
full_build_root = settings[/BUILD_ROOT = (.*)/].split[2] | |
full_build_root[/(.*)\/Build\/Products/] | |
root_for_gcovr = $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
class CalculatorFormController < Formotion::FormController | |
attr_accessor :calc | |
def done | |
puts "row done #{@form.render}" | |
@calc.got_answers @form.render | |
new_form = Formotion::Form.new(@calc.get_questions) | |
@form = new_form | |
@form.controller = self |
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
Around('@no_connection_to_qaserver') do |scenario, block| | |
%x[sudo ipfw add 10 deny tcp from qaserver to me] | |
%x[sudo ipfw add 11 deny tcp from me to qaserver] | |
block.call | |
%x[sudo ipfw delete 11 > /dev/null 2>&1] | |
%x[sudo ipfw delete 10 > /dev/null 2>&1] | |
end | |
Around('@no_network') do |scenario, block| | |
%x[sudo ifconfig en1 down] |
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
require 'frank-cucumber' | |
temp_app_path= `find . -regex ".*[Ff]rankified\.app$"`.chomp | |
if temp_app_path.empty? | |
temp_app_path= `find ../build -regex ".*[Ff]rankified\.app$"`.chomp | |
end | |
if temp_app_path.empty? | |
temp_app_path= `find ~/Library/Developer/Xcode/DerivedData -regex ".*[Ff]rankified\.app$"`.chomp |
NewerOlder