Skip to content

Instantly share code, notes, and snippets.

View natebird's full-sized avatar
🌐
Working online

Nate Bird natebird

🌐
Working online
View GitHub Profile
@natebird
natebird / init.coffee
Last active November 9, 2020 16:02
Atom Settings Backup
# Your init script
#
# Atom will evaluate this file each time a new window is opened. It is run
# after packages are loaded/activated and after the previous editor state
# has been restored.
#
# An example hack to log to the console when each text editor is saved.
#
# atom.workspace.observeTextEditors (editor) ->
# editor.onDidSave ->
@natebird
natebird / quote_migration.swift
Last active November 29, 2018 16:44
Vapor database migration examples using addProperties function
extension Quote: Migration {
static func prepare(on connection: PostgreSQLConnection) -> Future<Void> {
return Database.create(self, on: connection) { builder in
// Add fields from above
try addProperties(to: builder)
// Add FOREIGN KEY reference
builder.reference(from: \.authorID, to: \Author.id)
// make content UNIQUE and indexed
@natebird
natebird / old_postgresql_serializer.swift
Created April 10, 2017 12:03
postgresql_serializer 1.0
import Fluent
public final class PostgreSQLSerializer: GeneralSQLSerializer {
var positionalParameter: Int = 0
public override func serialize() -> (String, [Node]) {
self.positionalParameter = 0
let serialized = super.serialize()
@natebird
natebird / tourney.html
Created December 29, 2016 05:25 — forked from sterlingwes/tourney.html
Tournament Bracket Generator (Javascript + CSS, no tables)
<!DOCTYPE html>
<html>
<head>
<title>Tournament Bracket Generator</title>
<script src="http://code.jquery.com/jquery-1.8.3.min.js"></script>
<script src="http://underscorejs.org/underscore-min.js"></script>
<script>
$(document).on('ready', function() {
var knownBrackets = [2,4,8,16,32,64], // brackets with "perfect" proportions (full fields, no byes)
@natebird
natebird / sidekiq_image_assets
Last active August 30, 2016 15:59
Sidekiq image assets in base64
status.png - data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAB4AAABuCAYAAAAwEqNjAAAHVklEQVRo3u2Ze1BTVx7HTxSwdl1muuu6Ina0WlOLL0SlWlpEHj7KY5EVEYgISbiESIoJbwVCwiORZwyQ8EhICIgReQZYfFA6ts4+Oju7dme6O92HO9tuh+2qW8W2rl3C2XOYuc41G+DmCrP/3O/MZ37n/H7nd75ccu/N44JGsBvQYTBUPPRecsk7jnkIISNAA2qmQ+drP/271TfhU8c8Y+N6sIsWo8fzi1peOvB4nCh/kZpnbKxFzVR+Fpu3dEygDPmlvHmJY63JM/BJ66qwr4eipDoy54oZ2rv4km/8pzPGF4DfU/pC00f0nm//G43hcEy2mlrDWDbHfI5rg+HvmsncXEbXTxUfHzicceUGX3HA6n/yt62rwx6NCZW7ZozrUDPmprRmeR1nF0TjGboDhR+QNZIWr4OTuDYUk11O5hzNxk+rf2iLlmktW2L/St0Pjad7w9JtT//VNWDnUwwbIu6iCDGGVyLu2mKyqjv84j/p2Bn/B+PGyC9rOH7TuDaKjoTsITcais1dOhgtq2v8QdBjcg+MxsPf3ntI3HODKHV/5jWuRs0k1wSKAL1X2CQaw9lo23z0c2oP3uSaUPm2kRs94bhWvzp08iq/5KDTk6sS+D5Dy8aIL1GEjjT+OORRf7RUOy6tXn5Lrl9yQ1yxov+orKZt67E7NR577NS1Gs+AJ9ZgYmRMov7RrGe1GpmRDMbl5Zxf4jeNxtAR7argry/uF4ybdyd8XL86ZNLZmgsrg77pOyqrvYb+qHkvJxXYMcOH6Ch064/cQ2PoMhxfaPZPvH1VVOZN+zouB9tn6I/LyUcRuorWO/TBIK8g0eUbSCkyxZgDkn6BInQFvU/030bF5S8zunMpwDYwnKbcVObhZ0djWOrma7dGSfRXYrOKzYHJN+vWhn6l4GyHuEZFu+HI3VGJahnjW6YcbAWWg0Qfi
@natebird
natebird / String.swift
Created August 5, 2016 11:57 — forked from kharrison/String.swift
Swift String Playground Examples
// Swift Standard Librray - String
// Keith Harrison http://useyourloaf.com
// Import Foundation if you want to bridge to NSString
import Foundation
// ====
// Initializing a String
// ====
// UIWindow+AppSwitchScrollStopper.h
// Created by Tim Johnsen on 3/27/16.
#import <UIKit/UIKit.h>
@interface UIWindow (AppSwitchScrollStopper)
/// Call this early on in your app's lifecycle to avoid
/// scroll-related flashing when your app resumes from the background
- (void)installAppSwitchScrollStopper;
@natebird
natebird / SomeClass.swift
Last active September 28, 2016 16:48
Creating Color Constants by Extending UIColor
class SomeClass {
var fancyColor = UIColor.customDarkGreen()
var superFancyColor = UIColor.customLightGreen()
}
@natebird
natebird / gist:4287c2790f766c502318
Created February 23, 2016 16:55
Terrible Comcast customer service
Nate: My Issue: I can’t login / create new login account for new account number
Ramjot: I am here to assist you.
Ramjot: I can definitely help you with the login information.
Ramjot: It’s really difficult to remember passwords, we tend to forget. I am here to help you with your password reset.
Ramjot: For the account security, may I ask you a few questions?
@natebird
natebird / ruby-memoization-operator
Created January 6, 2016 18:42
Implementing the Ruby memoization operator ||= in Swift
//: Implementing Ruby's memoization operator in Swift
// From: https://airspeedvelocity.net/2014/06/10/implementing-rubys-operator-in-swift/
// define operator properties
infix operator ||= {
associativity right
precedence 90
assignment
}