This file contains hidden or 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
# silly_sum | |
def silly_sum numbers | |
sum = 0 | |
numbers.each_with_index {|number, index| | |
sum = sum + number*index | |
} | |
puts "sum = #{sum}" | |
end | |
puts "### silly_sum ###" |
This file contains hidden or 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 Book < ActiveRecord::Base | |
attr_accessible :title, :author, :lang, :genre, :shelf_id | |
belongs_to :shelves | |
def enshelf shelf_id | |
@book.shelf_id = shelf_id | |
end | |
def unshelf | |
# setting shelf_id to nil means book is not on the shelf |
This file contains hidden or 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
server { | |
listen 80; | |
root /home/username/example.com; | |
index index.php index.html; | |
server_name example.com; | |
location / { | |
try_files $uri $uri/ /index.php?q=$uri&$args; |
This file contains hidden or 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
production: | |
adapter: postgresql | |
encoding: unicode | |
pool: 5 | |
database: <%=ENV['OPENSHIFT_APP_NAME']%> | |
host: <%=ENV['$OPENSHIFT_POSTGRESQL_DB_HOST']%> | |
port: <%=ENV['$OPENSHIFT_POSTGRESQL_DB_PORT']%> | |
username: <%=ENV['OPENSHIFT_POSTGRESQL_DB_USERNAME']%> | |
password: <%=ENV['OPENSHIFT_POSTGRESQL_DB_PASSWORD']%> |
This file contains hidden or 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
# This file is used by Rack-based servers to start the application. | |
require ::File.expand_path('../config/environment', __FILE__) | |
run Rails.application |
This file contains hidden or 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
export RBENV_ROOT="${HOME}/.rbenv" | |
if [ -d "${RBENV_ROOT}" ]; then | |
export PATH="${RBENV_ROOT}/bin:${PATH}" | |
eval "$(rbenv init -)" | |
fi |
This file contains hidden or 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
## Enable gzip ## | |
gzip on; | |
gzip_disable "msie6"; | |
gzip_vary on; | |
gzip_min_length 5120; | |
gzip_proxied any; | |
gzip_comp_level 4; | |
gzip_buffers 16 8k; | |
gzip_http_version 1.1; |
This file contains hidden or 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
# Cache static content | |
location ~* \.(?:ico|css|js|gif|jpe?g|png)$ { | |
expires 30d; | |
add_header Vary Accept-Encoding; | |
access_log off; | |
} |
This file contains hidden or 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
/* loads minified jQuery (1.10.2) from Google CDN and jQuery migrate from jQuery CDN */ | |
function jquery_cdn() { | |
if (!is_admin()) { | |
wp_deregister_script('jquery'); | |
wp_deregister_script('jquery-migrate'); | |
wp_register_script('jquery', 'http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js', false, '1.10.2'); | |
wp_register_script('jquery-migrate', 'http://code.jquery.com/jquery-migrate-1.2.1.min.js', false, '1.2.1'); | |
wp_enqueue_script('jquery'); | |
wp_enqueue_script('jquery-migrate'); | |
} |
This file contains hidden or 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
# bash alias for turning on/off 2nd monitor | |
alias 2m_off='xrandr --output HDMI-0 --off' | |
alias 2m_on='xrandr --output HDMI-0 --auto --right-of VGA-0' |