Skip to content

Instantly share code, notes, and snippets.

View jdblack's full-sized avatar

James Blackwell jdblack

View GitHub Profile
...
Android {
buildTypes {
debug {
buildConfigField("String", "API_SERVER", "\"http://10.0.2.2:3000/\"")
}
release {
buildConfigField("String", "API_SERVER", "\"https://www.prod.xxxx.xxx.xxx/\"")
isMinifyEnabled = false
module Dig
def dig(path,default=nil)
puts "Entering dig"
path.split(".").inject(self) do |l,k|
l.respond_to?(:keys) ? (l.to_hash[k] || l.to_hash[k.to_sym] || default):default
end
end
end
ActiveRecord::Schema.define(version: 20170104013645) do
create_table "comments", force: :cascade do |t|
t.integer "stars"
t.string "review"
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
t.index [nil, nil], name: "index_comments_on_commentable_type_and_commentable_id"
end
@jdblack
jdblack / Rakefile
Created January 1, 2017 23:52 — forked from schickling/Rakefile
Activerecord without Rails
require "active_record"
namespace :db do
db_config = YAML::load(File.open('config/database.yml'))
db_config_admin = db_config.merge({'database' => 'postgres', 'schema_search_path' => 'public'})
desc "Create the database"
task :create do
ActiveRecord::Base.establish_connection(db_config_admin)
jblack@comet$ cat ~/.chef/knife.rb | grep -v "^#" | grep -v "digital_ocean_access_token"
current_dir = File.dirname(__FILE__)
log_level :info
log_location STDOUT
node_name "jblack"
client_key "#{current_dir}/jblack.pem"
validation_client_name "linuxguru-validator"
validation_key "#{current_dir}/linuxguru.chef-validator.pem"
chef_server_url "https://chef.linuxguru.net/organizations/linuxguru"
cache_type 'BasicFile'
require 'finite_machine'
require 'pp'
class StopLight < FiniteMachine::Definition
events {
initial :red
event :power_on, :off => :red
# event :power_off, :any => :off
event :power_off, [:on, :red, :green, :yellow] => :off
event :change, :red => :green
@jdblack
jdblack / gist:da033a8bd3d542773f2a
Last active August 29, 2015 14:01
tutorial mismatch
jblack@sirius:~/blog$ cat config/routes.rb
Rails.application.routes.draw do
get 'welcome/index'
# The priority is based upon order of creation: first created -> highest priority.
# See how all your routes lay out with "rake routes".
# You can have the root of your site routed with "root"
root 'welcome#index'