Skip to content

Instantly share code, notes, and snippets.

View travisp's full-sized avatar

Travis Pew travisp

View GitHub Profile

(a gist based on the old toolmantim article on setting up remote repos)

To collaborate in a distributed development process you’ll need to push code to remotely accessible repositories.

This is somewhat of a follow-up to the previous article setting up a new rails app with git.

For the impatient

Set up the new bare repo on the server:

@travisp
travisp / cmd-line-error
Created October 31, 2011 20:01
Ruby 1.9.2-p290 install via RVM 1.9.2
ruby-1.9.2-p290 - #fetching
ruby-1.9.2-p290 - #extracted to /home/travis/.rvm/src/ruby-1.9.2-p290 (already extracted)
Fetching yaml-0.1.4.tar.gz to /home/travis/.rvm/archives
Extracting yaml-0.1.4.tar.gz to /home/travis/.rvm/src
Configuring yaml in /home/travis/.rvm/src/yaml-0.1.4.
Compiling yaml in /home/travis/.rvm/src/yaml-0.1.4.
ERROR: Error running 'make ', please read /home/travis/.rvm/log/ruby-1.9.2-p290/yaml/make.log
Installing yaml to /home/travis/.rvm/usr
ERROR: Error running 'make install', please read /home/travis/.rvm/log/ruby-1.9.2-p290/yaml/make.install.log
ruby-1.9.2-p290 - #configuring
c/environment.rb
# Load the rails application
require File.expand_path('../application', __FILE__)
# Initialize the rails application
Mokabla::Application.initialize!
if defined?(PhusionPassenger) && !Rails.env.development?
PhusionPassenger.on_event(:starting_worker_process) do |forked|
# Reset Rails's object cache
# Only works with DalliStore
require File.expand_path('../boot', __FILE__)
require 'rails/all'
# If you have a Gemfile, require the gems listed there, including any gems
# you've limited to :test, :development, or :production.
Bundler.require(:default, Rails.env) if defined?(Bundler)
module Mokabla
class Application < Rails::Application
@travisp
travisp / invitations_controller.rb
Created March 9, 2012 15:56
devise_invitable with omniauthable
class InvitationsController < Devise::InvitationsController
# GET /resource/invitation/accept?invitation_token=abcdef
def edit
if params[:invitation_token] && self.resource = resource_class.to_adapter.find_first( :invitation_token => params[:invitation_token] )
session[:invitation_token] = params[:invitation_token]
render :edit
else
set_flash_message(:alert, :invitation_token_invalid)
redirect_to after_sign_out_path_for(resource_name)
@travisp
travisp / gist:5320330
Created April 5, 2013 15:45
Correct validation for Balanced Payments bank accounts
balanced.bankAccount.validate({
bank_code: '321174851',
account_number: '09877765432111111',
name: 'Tommy Q. CopyPasta'
})
SystemStackError - SystemStackError:
kernel/common/type.rb:412:in `object_initialize_clone'
kernel/bootstrap/string.rb:103:in `clone'
kernel/common/string.rb:1648:in `each_line'
kernel/common/enumerator.rb:70:in `each_with_block'
kernel/common/enumerator.rb:60:in `each'
kernel/common/enumerable.rb:150:in `to_a'
kernel/common/string.rb:1675:in `lines'
racc (1.4.10) lib/racc/compat.rb:27:in `to_a'
activesupport (4.0.1) lib/active_support/cache.rb:96:in `retrieve_cache_key'
class QueenCheck
def self.safe_moves(q, k)
z=->(p){q[0]==p[0]||q[1]==p[1]||(-7..7).map{|d|q.map{|x|x+d}}.include?(p)};z[k]?(t=[-1,0,1]).product(t).count{|a,b|(c=[k[0]+a,k[1]+b]).all?{|x|(1..8)===x}&&!z[c]}:-1
end
def self.safe_moves_explanation(queen_coords, king_coords)
is_check = -> (king_coords) {
return true if queen_coords[0] == king_coords[0] || queen_coords[1] == king_coords[1]
(-7..7).map do |diagonal_move|
# frozen_string_literal: true
begin
require "bundler/inline"
rescue LoadError => e
$stderr.puts "Bundler version 1.10 or later is required. Please update your Bundler"
raise e
end
gemfile(true) do
# frozen_string_literal: true
begin
require "bundler/inline"
rescue LoadError => e
$stderr.puts "Bundler version 1.10 or later is required. Please update your Bundler"
raise e
end
gemfile(true) do