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
use database_name; | |
source path/to/file.sql; |
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. Install and update upstream | |
//Add remote upstream | |
git remote add upstream SSH_REMOTE_URI | |
//Update the new remote that was added | |
git fetch upstream | |
//Update your current master with remote upstream/master (the --rebase flag MUST be with the pull action) | |
git pull --rebase upstream master |
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
"trim_trailing_white_space_on_save": true |
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
<%= fields_for @tour do |tour_fields| %> | |
<%= tour_fields.fields_for :dispatches, @dispatches do |dispatch_fields| %> | |
<tr> | |
<td><%= if dispatch_fields.object.published? then "Published"; elsif dispatch_fields.object.new_record? then "undefined"; else "Draft"; end%></td> | |
<td><%= dispatch_fields.object.dispatch_date %></td> | |
<td><%= dispatch_fields.object.venue %></td> | |
<td><%= dispatch_fields.object.address%></td> | |
<div class="dispatchFields"> | |
<%= dispatch_fields.hidden_field :id, value: dispatch_fields.object.id unless dispatch_fields.object.id.nil? %> | |
<%= dispatch_fields.hidden_field :artist_id, value: current_artist.id %> |
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
class Photo < ActiveRecord::Base | |
module Statues | |
QUEUED = 'queued' | |
NEW = 'new' | |
def self.values | |
constants.map(&method(:const_get)) | |
end | |
# you can define more special methods as you wanted for Statues | |
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
# config/routes.rb | |
resources :documents do | |
resources :versions, controller: "documents/versions" do | |
post :restore, on: :member | |
end | |
resource :lock, controller: "documents/locks" | |
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
# Hides Draper decorator inside the model and lazily decorates resources | |
# | |
# https://gist.github.com/firedev/7a82059b30a2157d4c56 | |
# | |
# model.rb: | |
# include Decorated | |
# | |
# Just make sure there are no overlapping method names in ModelDecorator | |
module Decorated |
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
class CreateRelations < ActiveRecord::Migration | |
def change | |
create_table :relations do |t| | |
t.references :user, index: true, foreign_key: true | |
t.integer :friend_id, index: true | |
t.timestamps null: false | |
end | |
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
brew update && brew upgrade --all && brew cleanup && brew prune |
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 gen(nums, digit) | |
result = [] | |
nums.each_with_index do |num, i| | |
slice = nums[i, digit] | |
tmp = slice.concat(nums[i + digit]) | |
result.push(tmp) | |
end | |
result | |
end | |
gen([0,1,2],1) |
OlderNewer