Skip to content

Instantly share code, notes, and snippets.

View auduchinok's full-sized avatar

Eugene Auduchinok auduchinok

View GitHub Profile
@kristopherjohnson
kristopherjohnson / flip.swift
Created July 13, 2014 01:51
Swift: For a function that takes two arguments, return equivalent function with argument order reversed (like Haskell "flip")
// For a function that takes two arguments, return equivalent
// function with argument order reversed.
//
// (Like "flip" in Haskell prelude)
func flip<A, B, T>(f: (A, B) -> T) -> (B, A) -> T {
return { (b: B, a: A) -> T in return f(a, b) }
}
// Examples
@searls
searls / octohooks.rb
Last active May 13, 2017 14:57
Use Octokit to add a particular webhook to all of your repos (handy for things like chat integration)
# This is just a scratchpad after I hacked what I needed in an irb session
require 'octokit'
Octokit.configure do |c|
c.login = 'searls'
c.password = 'c0d3b4ssssss!'
end
client = Octokit::Client.new
repos = client.repos #Note, for an org's repos, see `client.orgs.first.rels[:repos].get.data`