View quicker github repos init
# make your repos on github | |
git clone git@github.com:YOU/NEW_REPOS.git | |
# Initialized empty Git repository in /Users/timruffles/Development/CapistranoLearning/.git/ | |
# warning: You appear to have cloned an empty repository. | |
touch README | |
nano README # add readme | |
git add . | |
git commit -m 'Initial import' | |
git push origin master |
View Configable.rb
require 'net/http' | |
require 'yaml' | |
module Configable | |
def configure(setup) | |
setup.each_pair do |key,val| | |
if self.respond_to? key + '=' | |
self.send(key + '=', val) | |
else | |
instance_variable_set('@' + key, val) |
View build_report.html.erb
# cruisecontrol/app/views/build_mailer/build_report.html.erb | |
<% if Configuration.dashboard_url -%> | |
<%= @message %> | |
CHANGES | |
------- | |
<% | |
require 'uri' | |
repos = URI.parse(@build.project.source_control.repository) | |
for_viewing_url = "https://#{repos.host}#{repos.path.gsub(/\.git\/?$/,'')}" |
View gist:706738
div#comwrapper{ | |
position:relative; | |
height: 70px; | |
overflow: hidden; | |
zoom: 1; | |
background: $main_bg; | |
color: #fff; | |
font-size: 12px; | |
margin-bottom: 10px; |
View application_controller.rb
# To specify custom behavior that will be taken if the validation fails, pass a block to this method. | |
# It'll be called with |reason, default_action_as_proc| | |
def validate_rights(action, object = nil, message = nil) | |
@validate_rights_has_been_called = true | |
return true if action == :unprotected | |
take_action = false | |
respond_to do |format| | |
if !logged_in? | |
reason = :not_logged_in | |
format.html do |
View useage_example.rb
def user_allowed_to_deposit? | |
validate_rights :deposit do |reason, default| | |
if reason == :acl_failed | |
flash[:notice] = "We need to verify your identity before you can deposit." | |
redirect_to(new_account_idcheck_path) | |
else | |
default.call | |
end | |
end | |
end |
View bonus_confusion_smell.rb
end | |
end | |
previous_last_bonus = @user.bonuses.any? && @user.bonuses.last | |
if !problems && @user.save_with_identity(@identity) | |
flash[:notice] = "The user has been updated." | |
if @user.bonuses.any? && @user.bonuses.last.bonus_offer.is_bet_for_free? && @user.bonuses.last != previous_last_bonus | |
flash[:notice] += " We have awarded the bet for free bonus for the user." | |
end |
View switchy_views.rb
<%= | |
if not logged_in? | |
# Log in | |
# A button for each stake | |
@real_game.stake_amounts.sum do |stake_amount| | |
render 'games/buttons/login_to_play_stake', :stake_amount => stake_amount | |
end | |
elsif current_user.has_enough_funds_to_bet? |
View runnable_cuke_failers.sh
# assign failers via export FAILERS = ' | |
# paste after opening the quote, and close after the pasted contents | |
echo $FAILERS | ruby -e 'puts STDIN.read.split("cucumber").map {|l| l.gsub(/^ (\S*):\d*.*/,"\\1")}.uniq.join(" ")' |
View sinatra_awesome_css_js_html.rb
# sass handler | |
get /\/(.*)\.css/ do |stylesheet| | |
headers 'Content-Type' => 'text/css; charset=utf-8' | |
sass stylesheet.to_sym | |
end | |
# coffee script handler | |
get %r{/(.*)\.js} do |js| | |
# compile coffee script and place in respective JS folder | |
coffee = "#{ROOT_DIR}/js/#{js}.coffee" |
OlderNewer