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
# /etc/init/sidekiq.conf - Sidekiq config | |
# This example config should work with Ubuntu 12.04+. It | |
# allows you to manage multiple Sidekiq instances with | |
# Upstart, Ubuntu's native service management tool. | |
# | |
# See workers.conf for how to manage all Sidekiq instances at once. | |
# | |
# Save this config as /etc/init/sidekiq.conf then mange sidekiq with: | |
# sudo start sidekiq index=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
require 'formula' | |
class Pngout < Formula | |
url 'http://static.jonof.id.au/dl/kenutils/pngout-20110722-darwin.tar.gz' | |
homepage 'http://www.jonof.id.au/kenutils' | |
md5 'ce70a9d70e08b1920e5ac88d130d0eb9' | |
version '20110722' | |
def install | |
prefix.install Dir['*'] |
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
[core] | |
excludesfile = /Users/!!!INSERT YOUR COMPUTER USERNAME!!!/.gitignore | |
[push] | |
default = current | |
[color] | |
ui = true | |
[user] | |
name = !!!INSERT YOUR NAME!!! | |
email = !!!INSERT YOUR EMAIL!!! | |
[github] |
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
// | |
// SecureKeyValue.swift | |
// | |
// Created by Andrew Crookston <andrew@caoos.com> on 1/5/16. | |
// Copyright © 2016. License: MIT. | |
// | |
import Foundation | |
import Locksmith |
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
module Enumerable | |
def normalize | |
magnitude = Math.sqrt(reduce(:+)) | |
return self if magnitude.nan? | |
map { |x| x.to_f / magnitude } | |
end | |
def similarity(arr) | |
return 0.0 if arr.count != count | |
similarity = Math.sqrt(zip(arr).map { |d| d.first * d.second }.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
extension UICollectionView { | |
func indexPathsForCloseItems(offset: Int) -> [IndexPath] { | |
var indexes = indexPathsForVisibleItems.sorted(by: { $0.row < $1.row }) | |
for x in indexes { | |
print("had: \(x)") | |
} | |
if let index = indexes.last { |
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
class LinkedListNode<T> { | |
var next : LinkedListNode<T>? | |
var value: T | |
var count : Int { | |
return next == nil ? 1 : next!.count + 1 | |
} | |
init(_ value: T, _ next: LinkedListNode<T>?=nil) { |
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
protocol EnumCollection : Hashable {} | |
extension EnumCollection { | |
static func enumerated() -> AnySequence<Self> { | |
typealias S = Self | |
return AnySequence { () -> AnyIterator<S> in | |
var raw = 0 | |
return AnyIterator { | |
let current = withUnsafePointer(to: &raw) { | |
$0.withMemoryRebound(to: S.self, capacity: 1) { $0.pointee } |