View renameToHash.sh
#!/bin/bash
# TODO: skip tiny files (so small they couldn't be photos)
# TODO: make sure sym links and other file system oddities are handled
# TODO: look at paralellization for perf boost
#
# Constants
#
CHAR_COUNT=12
BLOCK_COUNT=6
View Animate.swift
import Foundation
/*
A starter animation library for swift.
These abstractions make it easier to chain multiple behaviors (eg: anticpate, then slam, then fade)
because you can use them as single liners and reason only about the actions.
Usage:
View most-beautiful-js-ever.js
// Pull a secret string out of ordered triplets
// https://www.codewars.com/kata/recover-a-secret-string-from-random-triplets/train/javascript
// https://www.codewars.com/kata/53f40dff5f9d31b813000774/solutions/javascript
// @LesRamer
var recoverSecret = function(triplets) {
for(var [first] of triplets)
{
if (triplets.every(tuple => tuple.indexOf(first) <= 0))
{
View swift-possible-bug-03.md

No Runtime Error:

func == (l: Car, r: Car) -> Bool { return l.vin == r.vin }
struct Car { let vin: String }
protocol hasDriversLicense: class {
  var car: Car? { get set }
}
class YoungPro: hasDriversLicense {
View hamming.go
// https://programmingpraxis.com/2011/08/30/hamming-numbers/
// cosmin said
// October 30, 2012 at 7:14 PM
// Another solution based upon Dijkstra’s paper:
def hammingSeq(N):
h = [1]
i2, i3, i5 = 0, 0, 0
for i in xrange(1, N):
x = min(2*h[i2], 3*h[i3], 5*h[i5])
View ubuntu-setup.sh
# Update the system's packages
apt-get update
apt-get upgrade
# Set up the `deploy` user
useradd deploy
mkdir /home/deploy
mkdir /home/deploy/.ssh
chmod 700 /home/deploy/.ssh
usermod -s /bin/bash deploy
View Offline Album Art - Spotify Feature Request.md

If you use Spotify without cellular data, all you'll ever see for album art is a gray circle with a white musical note inside it.

image

I'm pretty familiar with spotify. Been a paid subscriber for a long time and visited Sweden, staying in the Jarl Birger hotel right under you guys. :)

Still, I never noticed how much I missed album art until one day I accidentally left cellular data on and chewed through a half gig of data.

I love album art. It's beautiful, connects me to the band, and I always want to see it.

View Wrap+Unbox+Symmetrical.swift
//
// A definition for the kind of model objects this library can work on
//
import Foundation
public protocol CollieModel: Unboxable, WrapCustomizable, Hashable, CustomStringConvertible {
/// Configure the mapping between client and server property names. keys are client names and values are JSON names eg: "authorId: "author_id"
static var propertyMapping: [String: String]? { get }
View optionalEnum.swift
enum Coin {
case heads
case tails
}
var result: Coin?
// You can pattern match against it like an optional:
switch result {
case .heads?: print("heads")
case .tails?: print("tails")
View openDeepLink.swift