Skip to content

Instantly share code, notes, and snippets.

🏠
Working from home

Nate Bird natebird

🏠
Working from home
Block or report user

Report or block natebird

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@natebird
natebird / quote_migration.swift
Last active Nov 29, 2018
Vapor database migration examples using addProperties function
View quote_migration.swift
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
View old_postgresql_serializer.swift
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 Dec 29, 2016 — forked from sterlingwes/tourney.html
Tournament Bracket Generator (Javascript + CSS, no tables)
View tourney.html
<!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 Aug 30, 2016
Sidekiq image assets in base64
View sidekiq_image_assets
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 Aug 5, 2016 — forked from kharrison/String.swift
Swift String Playground Examples
View String.swift
// Swift Standard Librray - String
// Keith Harrison http://useyourloaf.com
// Import Foundation if you want to bridge to NSString
import Foundation
// ====
// Initializing a String
// ====
View UIWindow+AppSwitchScrollStopper.h
// 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 Sep 28, 2016
Creating Color Constants by Extending UIColor
View SomeClass.swift
class SomeClass {
var fancyColor = UIColor.customDarkGreen()
var superFancyColor = UIColor.customLightGreen()
}
@natebird
natebird / gist:4287c2790f766c502318
Created Feb 23, 2016
Terrible Comcast customer service
View gist:4287c2790f766c502318
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 Jan 6, 2016
Implementing the Ruby memoization operator ||= in Swift
View ruby-memoization-operator
//: 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
}
View advent-day-1.swift
//: Playground - noun: a place where people can play
import Foundation
func calculateFloor(input: String) -> Int {
let opening_parentheses_count = input.stringByReplacingOccurrencesOfString(")", withString: "").characters.count
let closing_parentheses_count = input.stringByReplacingOccurrencesOfString("(", withString: "").characters.count
let result = opening_parentheses_count - closing_parentheses_count
You can’t perform that action at this time.