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
| require 'fileutils' | |
| require 'win32-sound' | |
| FILE_UTILS_NOOP = false | |
| IMAGE_TYPES_REGEX = /.(jpg|gif|jpeg|png|mpg)$/i | |
| DOC_TYPES_REGEX = /(?<!mavica).(doc|txt|docx|xls|xlsx|html|htm|zip)$/i | |
| IMAGES_DIRECTORY = "C:/Users/Alec/Documents/floppys/images" | |
| OTHER_DIRECTORY = "C:/Users/Alec/Documents/floppys/docs" | |
| ALWAYS_IGNORE_REGEX = /(System Volume Information|.411|MAVICA.htm)$/i | |
| FAILURE_WAV = "C:/Windows/Media/Windows Hardware Fail.wav" |
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 PostsController < ApplicationController | |
| def show | |
| @post = Post.find(params[:id]) | |
| respond_to do |format| | |
| format.html # GET /posts/1 | |
| format.json { render :json => @post } # GET /posts/1.json | |
| end | |
| end |
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
| web: bundle exec puma -C config/puma.rb |
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
| #! /usr/bin/env sh | |
| # Generate a new, simple sinatra app | |
| # Usage: sinatra-new name_of_app | |
| set -e | |
| dir=$1 | |
| mkdir -p $dir/{views,public} | |
| cd $dir |
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
| var RailsForm = React.createClass({ | |
| propTypes: { | |
| csrf: React.PropTypes.shape({ | |
| param: React.PropTypes.string, | |
| token: React.PropTypes.string | |
| }).isRequired | |
| }, | |
| getDefaultProps: function() { | |
| return { |
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
| diff -r app-with-ar/Gemfile app-without-ar/Gemfile | |
| 6,7d5 | |
| < # Use sqlite3 as the database for Active Record | |
| < gem 'sqlite3' | |
| diff -r app-with-ar/Gemfile.lock app-without-ar/Gemfile.lock | |
| 97d96 | |
| < sqlite3 (1.3.9) | |
| 123d121 | |
| < sqlite3 | |
| diff -r app-with-ar/config/application.rb app-without-ar/config/application.rb |
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
| # Ensures that we can save a news item and queue up the right jobs around it | |
| class NewsSaveService | |
| def self.save!(news) | |
| new(news).save! | |
| end | |
| def initialize(news) | |
| @news = news | |
| end |
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
| namespace 'manage', as: '' do | |
| resources :programs | |
| end | |
| #---- | |
| $ rake routes | |
| Prefix Verb URI Pattern Controller#Action | |
| programs GET /manage/programs(.:format) manage/programs#index | |
| POST /manage/programs(.:format) manage/programs#create |
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 ApplicationController < ActionController::Base | |
| # see: http://guides.rubyonrails.org/action_controller_overview.html#rescue-from | |
| rescue_from ApiKey::NotAuthorized, with: :api_key_not_authorized | |
| rescue_from ActiveRecord::RecordNotFound, with: :record_not_found | |
| private | |
| # see: http://guides.rubyonrails.org/layouts_and_rendering.html#options-for-render | |
| def record_not_found | |
| render file: '404.html', status: :not_found |
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
| module Foo | |
| def run | |
| puts 'Does the thing' | |
| end | |
| end | |
| class Bar | |
| include Foo | |
| end |
NewerOlder