This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def gravatar_url(email,options = {}) | |
require 'digest/md5' | |
hash = Digest::MD5.hexdigest(email) | |
url = "http://www.gravatar.com/avatar/#{hash}" | |
options.each do |option| | |
option == options.first ? url+="?" : url+="&" | |
key = option[0].to_s | |
value = option[1].to_s | |
url+=key + "=" + value | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Authorization | |
extend Lockdown::Access | |
#---------------------------------------------------------------------------- | |
# Public | |
#---------------------------------------------------------------------------- | |
# Access to all methods on the home controller | |
permission 'home' | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//: 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 | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//: 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 | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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? |