Skip to content

Instantly share code, notes, and snippets.

View nicholasspencer's full-sized avatar

Nico Spencer nicholasspencer

View GitHub Profile
@nicholasspencer
nicholasspencer / FVAF
Created August 30, 2012 21:50
FUCKING VERTICAL ALIGN FIX
var MMThunderDomeContestantView = MatchbookView.extend({
initialize: function () {
this.parent = this.options.parent || {};
this.model = this.options.model || new App.Model.Profile();
}
, template: function () {
if (this._template) return this._template;
this._template = Handlebars.compile($("#mm-thunderdome-contestant-tmpl").html());
return this._template;
}
if (self.showERN && (self.email.emailReadString != nil)) {
NSString *ernText = self.email.emailReadString != nil ? self.email.emailReadString : @"Not Yet Read"; //wat
@nicholasspencer
nicholasspencer / Commented code
Last active December 20, 2015 07:09
"Sure I comment my code" seriously wtf.
//
// Intent photoPreviewUploadPageIntent = new Intent(getActivity(), PhotoPreviewUploadPage.class);
// photoPreviewUploadPageIntent.putExtras(bundle);
// if(!TextUtils.isEmpty(action)){
// photoPreviewUploadPageIntent.setAction(action);
// }
// photoPreviewUploadPageIntent.putExtra("requestCode", requestCode);
// activity.startActivityForResult(photoPreviewUploadPageIntent,
// requestCode);
//

Keybase proof

I hereby claim:

  • I am nicholasspencer on github.
  • I am nicholasspencer (https://keybase.io/nicholasspencer) on keybase.
  • I have a public key whose fingerprint is A3EB 61B1 A954 D95D 6EF5 13DE 2E38 C954 39E5 0474

To claim this, I am signing this object:

@nicholasspencer
nicholasspencer / keybase.md
Last active August 28, 2017 20:13
keybase.md

Keybase proof

I hereby claim:

  • I am nicholasspencer on github.
  • I am nicholasspencer (https://keybase.io/nicholasspencer) on keybase.
  • I have a public key ASAfP6E2ld8s5HdDKTDH-H94Y1NLagYY0rV6vRkaW95hAwo

To claim this, I am signing this object:

@nicholasspencer
nicholasspencer / component.examples.js.jsx
Last active August 29, 2015 14:15
React component styles
// *******************************************
// React Component w/ verbose rendering out-of-line
// *******************************************
var reactRenderCodeElseWhere = function() {
/* maybe do some calculations; smoke some chocolate cigarettes; */
return React.DOM.div (
//attributes
{},
//children
[
@nicholasspencer
nicholasspencer / bind.js
Last active August 29, 2015 14:18
Everytime I stumble across this I die a little inside
var self = this;
struct HashTable<Key: Hashable, Value> {
private typealias Element = (key: Key, value: Value)
private typealias Bucket = [Element]
private typealias IndexPath = (bucket: Int, index: Int?)
private var buckets: [Bucket]
private(set) var count = 0
public init(capacity: Int) {
@nicholasspencer
nicholasspencer / gifplease.sh
Last active March 18, 2019 21:31
Quicktime Screen Recording to GIF
#!/usr/bin/env bash
# converts .mov (quicktime screen recordings) to animated .gif images
# requires ffmpeg and gifsicle which are easily `brew install`'d
gifplease() {
ffmpeg -i $1 -pix_fmt rgb24 -r 10 -f gif - | gifsicle --optimize=3 --delay=8 > $1.gif
gif="$(pwd)/$1.gif"
echo "👉 $gif"
open -na Safari "file://$gif"
}
@nicholasspencer
nicholasspencer / on-demand.swift
Created January 3, 2019 14:52
On-demand nil coalescing infix operator
import Foundation
infix operator ??=: NilCoalescingPrecedence
func ??= <T>(left: inout T?, right: T) -> T? {
left = left ?? right
return left
}
class MyClass {
private var _onDemand: Date?