Skip to content

Instantly share code, notes, and snippets.

View raid5's full-sized avatar

Adam McDonald raid5

View GitHub Profile
@simeonwillbanks
simeonwillbanks / oa-identity.md
Created June 1, 2011 17:10
#omniauth #oauth OmniAuth oa-identity
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"
@yeradis
yeradis / oclint-xcode-build-phases_run_script.sh
Created April 29, 2017 07:04
OCLint + XCPretty + XCode integration as and Aggregate target
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
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;
@vangberg
vangberg / README
Created February 22, 2009 01:06
Deploying a Sinatra app to Heroku
# 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.
@brennanMKE
brennanMKE / RxExtensions.swift
Created May 25, 2018 17:46
Missing functionality from RxSwift
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)) })
}
@kakajika
kakajika / flatMapCompletable.swift
Created February 16, 2018 10:02
Single::flatMapCompletable in RxSwift
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()
}
@ijoshsmith
ijoshsmith / arrayToDict.swift
Last active November 1, 2019 05:08
Create Swift Dictionary from Array
/**
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([:]) {
@guilhermearaujo
guilhermearaujo / README.md
Last active July 27, 2022 09:36
OCLint integration with Xcode

OCLint integration with Xcode

1. Integration

  • Add a new Target of kind Aggregate, name it OCLint
  • Under Builde Phases, add a new Run Script Phase
  • Paste the script

2. Usage

  • Select target OCLint
  • Build the target (press ⌘+B)
@mhenrixon
mhenrixon / _form.html.haml
Created May 18, 2011 11:02
A complete sample of how to perform nested polymorphic uploads in rails using carrierwave
=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|