$ rails g model User
belongs_to
has_one
# Ways to execute a shell script in Ruby | |
# Example Script - Joseph Pecoraro | |
cmd = "echo 'hi'" # Sample string that can be used | |
# 1. Kernel#` - commonly called backticks - `cmd` | |
# This is like many other languages, including bash, PHP, and Perl | |
# Synchronous (blocking) | |
# Returns the output of the shell command | |
# Docs: http://ruby-doc.org/core/classes/Kernel.html#M001111 |
#!/bin/sh | |
set -u | |
set -e | |
# Example init script, this can be used with nginx, too, | |
# since nginx and unicorn accept the same signals | |
# Feel free to change any of the following variables for your app: | |
APP_ROOT=/home/deploy/public_html/rm/current | |
PID=$APP_ROOT/tmp/pids/unicorn.pid | |
ENV=production |
require 'rubygems' | |
require 'rack/oauth2' | |
client = Rack::OAuth2::Client.new( | |
:identifier => YOUR_CLIENT_ID, | |
:secret => YOUR_CLIENT_SECRET, | |
:redirect_uri => YOUR_REDIRECT_URI, # only required for grant_type = :code | |
:host => 'rack-oauth2-sample.heroku.com' | |
) |
#!/bin/sh | |
### BEGIN INIT INFO | |
# Provides: unicorn | |
# Required-Start: $local_fs $remote_fs mysql | |
# Required-Stop: $local_fs $remote_fs | |
# Default-Start: 2 3 4 5 | |
# Default-Stop: 0 1 6 | |
# Short-Description: unicorn initscript | |
# Description: Unicorn is an HTTP server for Rack application | |
### END INIT INFO |
source 'http://rubygems.org' | |
gem 'rspec' | |
gem 'capybara', :git => 'https://github.com/jnicklas/capybara.git' | |
gem 'launchy' | |
gem 'ruby-debug19' |
# MySQL. Versions 4.1 and 5.0 are recommended. | |
# | |
# Install the MySQL driver: | |
# gem install mysql2 | |
# | |
# And be sure to use new-style password hashing: | |
# http://dev.mysql.com/doc/refman/5.0/en/old-client.html | |
development: | |
adapter: mysql2 | |
encoding: utf8 |
############################################################################# | |
# to use this in jruby: | |
# | |
# jgem install sequel | |
# jgem install jdbc-sqlite3 | |
# | |
# for more info on the sequel library, go to http://sequel.rubyforge.org/ | |
############################################################################# | |
require 'rubygems' |
require 'uri' | |
require 'cgi' | |
require 'net/https' | |
require 'json' | |
require 'oauth2_mac_client' | |
# oauth2_mac_client gem at https://github.com/herestomwiththeweather/oauth2_mac_client | |
# usage using this test class: | |
# > client = OAuth2Client.new | |
# > client.get_token('refresh_token') # get a new MAC type access token |
#!/usr/bin/env ruby | |
# This is a basic deploy script for Heroku apps. | |
# It provides a structure you can use to expand on | |
# and add your own prereqs and deploy tasks. | |
# | |
# It basically ensures that: | |
# 1. There are no uncommited files | |
# 2. You can ssh to github | |
# 3. You can connect to heroku |