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
heffalump:~ james$ ruby -v | |
ruby 1.9.2p180 (2011-02-18 revision 30909) [x86_64-darwin10.7.1] | |
heffalump:~ james$ php -v | |
PHP 5.3.4 (cli) (built: Jan 17 2011 21:54:20) | |
Copyright (c) 1997-2010 The PHP Group | |
Zend Engine v2.3.0, Copyright (c) 1998-2010 Zend Technologies | |
heffalump:~ james$ cat foo.rb | |
msg = "Hello world" |
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
source ~/.bash_profile | |
cd ${SRCROOT} | |
xcodebuild clean | |
xcodebuild | tee xcodebuild.log | xcpretty -r json-compilation-database -o compile_commands.json | |
maxPriority=15000 | |
oclint-json-compilation-database -- -report-type xcode -max-priority-1=$maxPriority -max-priority-2=$maxPriority -max-priority-3=$maxPriority |
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
pragma solidity ^0.4.8; | |
contract Rubik { | |
enum Color {Red, Blue, Yellow, Green, White, Orange} | |
Color[9][6] state; | |
address public owner = msg.sender; | |
uint8 constant FRONT = 0; |
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
# Deploying a Sinatra app to Heroku | |
## Database | |
The location of the database Heroku provides can be found in the environment | |
variable DATABASE_URL. Check the configure-block of toodeloo.rb for an example | |
on how to use this. | |
## Server | |
Heroku is serving your apps with thin, with means you have all your thin goodness available, | |
such as EventMachine. |
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
import RxSwift | |
extension PrimitiveSequence where Trait == CompletableTrait, Element == Never { | |
public func asMaybe() -> Maybe<Never> { | |
return Maybe.create { maybe in | |
return self.subscribe( | |
onCompleted: { maybe(.completed) }, | |
onError: { error in maybe(.error(error)) }) | |
} |
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
extension PrimitiveSequenceType where Self: ObservableConvertibleType, Self.TraitType == SingleTrait { | |
func flatMapCompletable(_ selector: @escaping (E) -> Completable) -> Completable { | |
return self | |
.asObservable() | |
.flatMap { e -> Observable<Never> in | |
selector(e).asObservable() | |
} | |
.asCompletable() | |
} |
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
/** | |
Creates a dictionary with an optional | |
entry for every element in an array. | |
*/ | |
func toDictionary<E, K, V>( | |
array: [E], | |
transformer: (element: E) -> (key: K, value: V)?) | |
-> Dictionary<K, V> | |
{ | |
return array.reduce([:]) { |
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
=semantic_form_for [:admin, @dog], validate: true, html: {multipart: true} do |f| | |
=f.inputs do | |
=f.input :name | |
=f.input :kennel_name | |
=f.input :birthdate | |
=f.input :gender, as: :radio, collection: {'Tik' => 'F', 'Hane' => 'M'} | |
=f.input :father_id, as: :select, collection: @dogs | |
=f.input :mother_id, as: :select, collection: @bitches | |
=f.semantic_fields_for :pictures do |pic| |
OlderNewer