Skip to content

Instantly share code, notes, and snippets.

@yctay
yctay / gist:2503347
Created April 26, 2012 21:25 — forked from lucasfais/gist:1207002
Sublime Text 2 - Useful Shortcuts

Sublime Text 2 – Useful Shortcuts (Mac OS X)

General

⌘T go to file
⌘⌃P go to project
⌘R go to methods
⌃G go to line
⌘KB toggle side bar
⌘⇧P command prompt
@yctay
yctay / gist:2873139
Created June 5, 2012 06:43
Simple Timer Controls, with Bootstrap v2 CSS styles
<!-- Le CSS
============================== -->
<link href="https://raw.github.com/twitter/bootstrap/master/docs/assets/css/bootstrap.css" rel="stylesheet" type="text/css">
<!-- Le HTML
============================== -->
<div class="btn-group" id="timer-controls">
<a class="btn btn-success" id="timer-start" style="padding-left:47px;padding-right:48px;"><i class="icon-play icon-white"></i>&nbsp;Start</a>
</div>
@yctay
yctay / Gemfile
Created October 3, 2012 09:00 — forked from simi/Gemfile
Refinery + Twitter Bootstrap WIP
source 'https://rubygems.org'
gem 'rails', '3.2.1'
# Bundle edge Rails instead:
# gem 'rails', :git => 'git://github.com/rails/rails.git'
gem 'sqlite3'
@yctay
yctay / all_locale_switcher.html.erb
Created October 3, 2012 10:05
RefineryCMS frontend locale switcher
<!-- Locale switchers, but presents all available locales as options, even the presently active one -->
<ul>
<% Refinery::I18n.config.frontend_locales.each do |locale| %>
<li>
<%= link_to "/#{locale.to_s + request.path}", {:title => Refinery::I18n.locales[locale]} do%>
<span><%= Refinery::I18n.locales[locale] %></span>
<% end -%>
</li>
<% end %>
@yctay
yctay / memusage.rb
Created October 7, 2012 16:04 — forked from taiansu/memusage.rb
WebFaction Memory Usage Script
#!/usr/bin/env ruby
# Memory usage script for WebFaction customers adapted to attempt to
# draw username from the pwd
# Nick Trew <vxnick@gmail.com>
# 2009-05-25
# START CONFIG #
require 'pathname'
@yctay
yctay / deploy.rb
Created October 7, 2012 20:05 — forked from uhlenbrock/deploy.rb
Precompile assets locally for Capistrano deploy
load 'deploy/assets'
namespace :deploy do
namespace :assets do
desc 'Run the precompile task locally and rsync with shared'
task :precompile, :roles => :web, :except => { :no_release => true } do
%x{bundle exec rake assets:precompile}
%x{rsync --recursive --times --rsh=ssh --compress --human-readable --progress public/assets #{user}@#{host}:#{shared_path}}
%x{bundle exec rake assets:clean}
end
@yctay
yctay / deploy.rb
Last active August 31, 2017 13:43
Capistrano recipe for deploying to WebFaction
default_run_options[:pty] = true
ssh_options[:forward_agent] = true
set :user, "<< YOUR WEBFACTION USERNAME >>"
set :application, "<< YOUR APP NAME >>"
set :repository, "<< YOUR REPOSITORY ADDRESS >>"
set :deploy_to, "/home/<< YOUR WEBFACTION USERNAME >>/webapps/<< YOUR WEBAPP DIRECTORY >>"
set :default_stage, "production"
=Navigating=
visit('/projects')
visit(post_comments_path(post))
=Clicking links and buttons=
click_link('id-of-link')
click_link('Link Text')
click_button('Save')
click('Link Text') # Click either a link or a button
click('Button Value')
@yctay
yctay / knife.rb
Created April 29, 2013 10:22 — forked from jtimberman/knife.rb
# Knife Configuration File.
#
# This is a Ruby DSL to set configuration parameters for Knife's
# general options. The default location for this file is
# ~/.chef/knife.rb. If multiple Chef repositories are used,
# per-repository configuration files can be created. A per repository
# configuration file must be .chef/knife.rb in the base directory of
# the Chef repository. For example,
#
# ~/Development/chef-repo/.chef/knife.rb
@yctay
yctay / figaro-capistrano.rb
Created April 30, 2013 05:34
Capistrano recipe for deploying figaro's application.yml
namespace :figaro do
desc "SCP transfer figaro configuration to the shared folder"
task :setup do
transfer :up, "config/application.yml", "#{shared_path}/application.yml", :via => :scp
end
desc "Symlink application.yml to the release path"
task :finalize do
run "ln -sf #{shared_path}/application.yml #{release_path}/config/application.yml"
end