Skip to content

Instantly share code, notes, and snippets.

View soffes's full-sized avatar

Sam Soffes soffes

View GitHub Profile
@klaaspieter
klaaspieter / ASS.md
Created June 22, 2017 07:59 — forked from anonymous/ASS.md
Acronyms Seriously Suck - Elon Musk

From time to time, Musk will send out an e-mail to the entire company to enforce a new policy or let them know about something that's bothering him. One of the more famous e-mails arrived in May 2010 with the subject line: Acronyms Seriously Suck:

There is a creeping tendency to use made up acronyms at SpaceX. Excessive use of made up acronyms is a significant impediment to communication and keeping communication good as we grow is incredibly important. Individually, a few acronyms here and there may not seem so bad, but if a thousand people are making these up, over time the result will be a huge glossary that we have to issue to new employees. No one can actually remember all these acronyms and people don't want to seem dumb in a meeting, so they just sit there in ignorance. This is particularly tough on new employees.

That needs to stop immediately or I will take drastic action - I have given enough warning over the years. Unless an acronym is approved by me, it should not enter the SpaceX glossary.

@0xced
0xced / Emoji-iOS-10.0-14A5322e.json
Created August 8, 2016 22:38
Emoji from iOS beta 4 (14A5322e)
{
"People" : [
{
"Symbol" : "😀",
"Name" : "GRINNING FACE"
},
{
"Symbol" : "😬",
"Name" : "GRIMACING FACE"
},
@danieleggert
danieleggert / GPG and git on macOS.md
Last active May 3, 2024 12:26
How to set up git to use the GPG Suite

GPG and git on macOS

Setup

No need for homebrew or anything like that. Works with https://www.git-tower.com and the command line.

  1. Install https://gpgtools.org -- I'd suggest to do a customized install and deselect GPGMail.
  2. Create or import a key -- see below for https://keybase.io
  3. Run gpg --list-secret-keys and look for sec, use the key ID for the next step
  4. Configure git to use GPG -- replace the key with the one from gpg --list-secret-keys
@gwengrid
gwengrid / TypeErasure.swift
Last active September 12, 2018 05:14
Example of type erasure with Pokemon
class Thunder { }
class Fire { }
protocol Pokemon {
typealias PokemonType
func attack(move:PokemonType)
}
struct Pikachu: Pokemon {
typealias PokemonType = Thunder
@andrewbranch
andrewbranch / transpose-array-test.js
Created February 5, 2016 20:54
#algorithm challenge: more elegant way to do this
import { describe, it, beforeEach } from 'mocha';
import assert from 'assert';
import transposeArray from './transpose-array';
describe('transpose-array', () => {
let array;
beforeEach(() => array = [0, 1, 2, 3, 4, 5]);
it('works for downward transpositions', () => {
let result = transposeArray(array, 4, 2);
@calebd
calebd / Readme.markdown
Last active September 7, 2022 16:45
Run Loop Source

CFRunLoopSource is cool. It lets you build behavior similar to the mechanisms that drive setNeedsLayout and setNeedsDisplay in UIKit.

I found myself in need of something like this a couple of times. It's great to know that no matter how many times I say I need to update something, I will get a single callback at the end of the run loop that gives me a chance to perform my work.

Here is a little Swift wrapper that makes the API easier to deal with.

@portellaa
portellaa / Default (OSX).sublime-keymap
Last active March 26, 2024 09:06 — forked from lmdemanuel/Default (OSX).sublime-keymap
Sublime Text 3 - User keybindings "a la Xcode"
[
{ "keys": ["super+0"], "command": "toggle_side_bar" },
{ "keys": ["super+shift+o"], "command": "show_overlay", "args": {"overlay": "goto", "show_files": true} },
{ "keys": ["super+shift+y"], "command": "show_panel", "args": {"panel": "console", "toggle": true} },
{
"keys": ["super+enter"],
"command": "set_layout",
"args":
{
"cols": [0.0, 1.0],
@JaviLorbada
JaviLorbada / CustomFontPlayground.swift
Created August 31, 2015 19:09
Load custom fonts within Swift playgrounds
//: Playground - noun: a place where people can play
import UIKit
let fontURL = NSBundle.mainBundle().URLForResource("PillGothic300mg-bold", withExtension: "ttf")
CTFontManagerRegisterFontsForURL(fontURL!, CTFontManagerScope.Process, nil)
var pillGothicFontBold = UIFont(name: "PillGothic300mg-bold", size: 30)
var attrs = [NSFontAttributeName : pillGothicFontBold!,
# pragma mark Custom caret
- (void)drawInsertionPointInRect:(NSRect)aRect color:(NSColor *)aColor turnedOn:(BOOL)flag {
aRect.size.width = self.caretWidth;
[super drawInsertionPointInRect:aRect color:aColor turnedOn:flag];
}
// This is a hack to get the caret drawing to work. I know, I know.
- (void)setNeedsDisplayInRect:(NSRect)invalidRect {
invalidRect.size.width += self.caretWidth - 1;
@liscio
liscio / retinaify.sh
Created March 12, 2015 18:33
Make Preview open your @2x .png files as if they are retina images
#!/bin/sh
# First, set the width/height DPI on the file
sips -s dpiWidth 144 -s dpiHeight 144 "$1"
# Fake that it is a screen capture (wat?)
xattr -wx com.apple.metadata:kMDItemIsScreenCapture "62 70 6C 69 73 74 30 30 09 08 00 00 00 00 00 00 01 01 00 00 00 00 00 00 00 01 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 09" "$1"
xattr -wx com.apple.metadata:kMDItemScreenCaptureType "62 70 6C 69 73 74 30 30 59 73 65 6C 65 63 74 69 6F 6E 08 00 00 00 00 00 00 01 01 00 00 00 00 00 00 00 01 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 12" "$1"
xattr -wx com.apple.FinderInfo "00 00 00 00 00 00 00 00 00 10 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00" "$1"