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
# Detects user's browser. | |
def browser_name | |
ua = request.user_agent.downcase | |
if ua =~ /firefox\// | |
:firefox | |
elsif ua =~ /opera\// | |
:opera | |
elsif ua =~ /chrome\// |
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
= semantic_form_for(@event, :html => {:multipart => true, :id => "logoUpload", :'data-ajax' => false}) do |f| | |
= f.inputs do | |
= f.input(:logo, :as => :file) | |
= f.input(:logo_cache, :as => :hidden) | |
= f.input(:name) | |
= f.input(:info) | |
#matches | |
= f.inputs :for => [:matches] do |mf| | |
= render :partial => 'match_fields', :locals => {:f => mf} |
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 ListBootstrap < SimpleNavigation::Renderer::Base | |
def render(item_container) | |
list = item_container.items.inject([]) do |list, item| | |
if item.html_options[:opts] | |
if item.html_options[:opts][:nav_header] | |
list << li_header(item) | |
elsif item.html_options[:opts][:icon] | |
list << li_icon(item) | |
end | |
else |
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
# m h dom mon dow command | |
0 2 * * * ruby /path/to/db_backup.rb -d -e production -t dayly | |
0 2 * * 1 ruby /path/to/db_backup.rb -d -e production -t weekly |
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
#!/bin/bash | |
# Install with: | |
# bash < <(curl -L https://gist.github.com/jalberto/6053996/raw/bcbb6e14d4f26b56c6c589882f047a96a3ab587a/linecache19_install) | |
# | |
# Reference: http://blog.wyeworks.com/2011/11/1/ruby-1-9-3-and-ruby-debug | |
ruby_version="$(rvm info ruby | grep version | head -n1 | awk '{print $2}' | tr '"' ' ')" | |
echo "Installing ruby-debug with $ruby_version ..." |
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 Gists to store code you would like to remember later on | |
console.log(window); // log the "window" object to the console |
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
#!/bin/bash | |
# vim: set sw=2 sts=2 tw=80 : | |
shopt -s globstar | |
for file in $1/** | |
do | |
if test -f $file | |
then | |
CHARSET="$(file -bi "$file"|awk -F "=" '{print $2}')" | |
if [ "$CHARSET" != binary ]; then | |
if [ "$CHARSET" != utf-8 ]; then |
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
# lib/tasks/backup.rake | |
namespace :backup do | |
desc "Back up the database" | |
task :db do | |
sh "backup perform --trigger backupdb --config_file config/backup.rb --data-path db --log-path log --tmp-path tmp" | |
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
require 'capistrano/bundler' | |
require 'capistrano/rails' | |
require 'capistrano/rails/assets' | |
require 'capistrano/rails/migrations' | |
require 'capistrano/rvm' |
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
# Usage: | |
# 1. Drop this file into lib/capistrano/remote_cache_with_project_root_strategy.rb | |
# 2. Add the following to your Capfile: | |
# require 'capistrano/git' | |
# require './lib/capistrano/remote_cache_with_project_root_strategy' | |
# 3. Add the following to your config/deploy.rb | |
# set :git_strategy, RemoteCacheWithProjectRootStrategy | |
# set :project_root, 'subdir/path' | |
# Define a new SCM strategy, so we can deploy only a subdirectory of our repo. |
OlderNewer