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 / upgrade_to_refinery_two.rb
Created March 12, 2012 00:41 — forked from jadehopepunk/upgrade_to_refinery_two.rb
Migration to convert from refinery 1.0.8 to refinery 2.0
class UpgradeToRefineryTwo < ActiveRecord::Migration
def self.up
# For refinerycms-authentication
rename_table :roles_users, :refinery_roles_users
rename_table :roles, :refinery_roles
rename_table :user_plugins, :refinery_user_plugins
rename_table :users, :refinery_users
remove_column :refinery_users, :persistence_token
remove_column :refinery_users, :perishable_token
remove_column :refinery_users, :remember_token
class ActionDispatch::Routing::Mapper
def draw(routes_name)
instance_eval(File.read(Rails.root.join("config/routes/#{routes_name}.rb")))
end
end
BCX::Application.routes.draw do
draw :api
draw :account
draw :session
class Api::RegistrationsController < Api::BaseController
respond_to :json
def create
user = User.new(params[:user])
if user.save
render :json=> user.as_json(:auth_token=>user.authentication_token, :email=>user.email), :status=>201
return
else
@natebird
natebird / devise.rb
Last active December 19, 2015 21:39 — forked from wkrsz/devise.rb
#config/initializers/devise.rb
config.warden do |manager|
manager.strategies.add :token_header_authenticatable, TokenHeaderAuthenticatable
manager.default_strategies(:scope => :user).unshift :token_header_authenticatable
end
ENV["RAILS_ENV"] = "test"
require File.expand_path('../../config/environment', __FILE__)
require File.dirname(__FILE__) + '/blueprints'
require 'faker'
require 'rails/test_help'
require 'minitest/autorun'
require 'minitest/pride'
class MiniTest::Unit::TestCase
include MiniTest::ActiveRecordAssertions
@natebird
natebird / keybase.md
Created March 17, 2014 18:48
keybase identity proof

Keybase proof

I hereby claim:

  • I am natebird on github.
  • I am natebird (https://keybase.io/natebird) on keybase.
  • I have a public key whose fingerprint is 3134 7710 4658 445B 62AC D7CF 5A09 49BD 44FE 9C23

To claim this, I am signing this object:

Verifying that +natesbird is my openname (Bitcoin username). https://onename.io/natesbird
@natebird
natebird / advent-day-1.swift
Created December 17, 2015 21:03
AdventOfCode
//: 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
@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
}
@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?