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
require 'hirb' | |
Hirb.enable | |
old_print = Pry.config.print | |
Pry.config.print = proc do |output, value| | |
Hirb::View.view_or_page_output(value) || old_print.call(output, 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
def show | |
puts "Outputting a very lo-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-ong lo-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-ong line" | |
@widget = Widget(params[:id]) | |
respond_to do |format| | |
format.html # show.html.erb | |
format.json { render json: @widget } | |
end | |
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
.highlight { background: #ffffff; } | |
.highlight .c { color: #999988; font-style: italic } /* Comment */ | |
.highlight .err { color: #a61717; background-color: #e3d2d2 } /* Error */ | |
.highlight .k { font-weight: bold } /* Keyword */ | |
.highlight .o { font-weight: bold } /* Operator */ | |
.highlight .cm { color: #999988; font-style: italic } /* Comment.Multiline */ | |
.highlight .cp { color: #999999; font-weight: bold } /* Comment.Preproc */ | |
.highlight .c1 { color: #999988; font-style: italic } /* Comment.Single */ | |
.highlight .cs { color: #999999; font-weight: bold; font-style: italic } /* Comment.Special */ | |
.highlight .gd { color: #000000; background-color: #ffdddd } /* Generic.Deleted */ |
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
# Rails::API app | |
$ rails-api new [nplate-syjdata-api] --skip-sprockets --skip-test-unit | |
# Rails app | |
$ rails new [my-app-name] --skip-test-unit | |
$ rails generate controller PersonalityTests take results | |
$ rails g model Foo bar:string baz:integer | |
$ rails g migration AddWorkflowStateToGraduates workflow_state:string | |
$ rails g serializer doctor |
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
:limit Numeric Type Column Size Max value | |
--------- ------------ ----------- ---------- | |
1 tinyint 1 byte 127 | |
2 smallint 2 bytes 32767 | |
3 mediumint 3 byte 8388607 | |
nil, 4, 11 int(11) 4 byte 2147483647 | |
5..8 bigint 8 byte 9223372036854775807 | |
Note: by default MySQL uses signed integers, so the max. values noted are for signed integers. |
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
# A convinient way to stub out a current_user method if you are in the middle of development and don't want to add authentication yet: | |
class ApplicationController < ActionController::Base | |
... | |
def current_user | |
OpenStruct.new(admin?: false) | |
end | |
helper_method current_user |
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
# Mac OS X | |
# ========= | |
$ brew install | |
# To automatically load on login: | |
$ launchctl load ~/Library/LaunchAgents/homebrew.mxcl.redis.plist | |
# To refresh after upgrade: |
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
# Exports specified columns from doctors table to nplate_doctors.csv file | |
$ rails dbconsole | |
=# COPY doctors(customer_number,address_line_1,address_line_2,address_line_3,city,state,zip_code,primary_phone,prof_first_name,prof_middle_name,prof_last_name,prof_name_prefix,prof_name_suffix,primary_specialty,secondary_specialty,npi,ims,me,primary_specialty_dscr,latitude,longitude) TO '/Users/dmoore/projects/colddata-amgen/nplate_doc_finder/db/seeds/nplate_doctors.csv' DELIMITER ',' CSV HEADER; |
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
1. Generate new rails api structure | |
# he "-S" options removes the sprockets stuff, we dont need it since we will use Grunt | |
# for our frontend code. "-T" is because I use RSpec and no need for "test/" directory | |
$ rails-api new [app_name]-S -T | |
2. Remove everything from | |
$ cd [app_name] | |
$ rm -fr public/* |
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
# Mac OS X | |
# ============== | |
# Installation | |
$ brew update | |
$ brew doctor | |
$ brew install nginx | |
$ mkdir -p /usr/local/etc/nginx/sites-{enabled,available} | |
$ mkdir -p /usr/local/etc/nginx/logs | |
$ mkdir -p /usr/local/etc/nginx/conf.d |
OlderNewer