Skip to content

Instantly share code, notes, and snippets.

View wjlafrance's full-sized avatar
🐶
Wondering if Github is becoming a social network.

William LaFrance wjlafrance

🐶
Wondering if Github is becoming a social network.
View GitHub Profile
struct Fizzbuzz: Sequence, IteratorProtocol {
enum FizzbuzzValue: CustomDebugStringConvertible {
case fizz
case buzz
case fizzbuzz
case other(Int)
var debugDescription: String {
switch self {
import UIKit
protocol IdentifierDequeueableCell where Self: UITableViewCell {
static var dequeueIdentifier: String { get }
}
extension IdentifierDequeueableCell {
static var dequeueIdentifier: String {
return String(describing: self)
}
[{
"name": "Bernie Cinders",
"species": "dog"
},
{
"name": "Megatron",
"species": "cat"
},
{
"name": "Breeze",
@wjlafrance
wjlafrance / filesize.sh
Created April 12, 2017 02:22
usage: ./filesize.sh *.mp3
stat $1 | awk '{print $8}' | paste -sd "+" - | bc
@wjlafrance
wjlafrance / Output
Last active April 21, 2016 02:06
Testing whether use of local variables changes optimized machine code
$ uname -a
Linux massachusetts 4.4.0-18-generic #34-Ubuntu SMP Wed Apr 6 14:01:02 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux
$ clang -v
clang version 3.8.0-2ubuntu1 (tags/RELEASE_380/final)
Target: x86_64-pc-linux-gnu
Thread model: posix
InstalledDir: /usr/bin
Found candidate GCC installation: /usr/bin/../lib/gcc/i686-linux-gnu/5.3.1
Disk /dev/sdb: 1.8 TiB, 2000398934016 bytes, 3907029168 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disklabel type: gpt
Disk identifier: AFEAD945-DB42-1948-904A-B2FF804CFCEE
Device Start End Sectors Size Type
/dev/sdb1 2048 3907012607 3907010560 1.8T Solaris /usr & Apple ZFS
/dev/sdb9 3907012608 3907028991 16384 8M Solaris reserved 1
# Clone forks into ~/dev/forks, add upstreams
$ cd ~/dev/forks
$ git clone [email protected]:wjlafrance/articles.git NSHipster-articles
$ cd NSHipster-articles
$ git remote add upstream [email protected]:NSHipster/articles.git
# Rebase origin/master on top of upstream/master
$ cd ~/dev/forks/NSHipster-articles
@wjlafrance
wjlafrance / swift-compiled.swift
Created March 25, 2016 17:36
Example swift scripts
print("Content-type: text/html")
print("")
print("Hello from compiled Swift on the web!")
//: Playground - noun: a place where people can play
import Darwin
let alphabets: [[Character]] = [
["a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z"],
["A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z"]
]
func cipherWithRotation(rotation: Int) -> [Character: Character] {
Barebones PC:
Lenovo TS140
http://www.amazon.com/gp/product/B00F6EK9J2
$219.99 (2015-01-12)
Processor:
Intel Xeon E3-1231
http://www.amazon.com/gp/product/B00KB4A2XA
$254.99 (2016-02-25)