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
These two snippets can be copy/pasted into a Sublime Text 2 new snippet and saved as a [.]sublime-snippet | |
To create <%= <cursor> %> use rb=+tab | |
<snippet> | |
<content><![CDATA[<%= ${1} %>]]></content> | |
<tabTrigger>rb=</tabTrigger> | |
<description><%=… %></description> | |
</snippet> | |
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
/usr/sbin/update-rc.d -f unicorn defaults | |
chmod +x /etc/init.d/unicorn | |
/usr/sbin/update-rc.d -f unicorn remove |
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
= form_tag "/auth/identity/register", id: 'loginform' do | |
= error_messages_for @identity, :header_message => "" | |
%table | |
%tr{colspan: 2} | |
%td | |
= label_tag :title | |
= text_field_tag :title, @identity.try(:title), size: '32', class: 'logininput' | |
%tr | |
%td |
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 merge_pdfs | |
pdfs = [] | |
pdfs << @bulletin.pdf.path | |
@bulletin.bulletin_inserts.first.bulletin_insert_items.each do |bii| | |
if bii.pdf.present? | |
pdfs << bii.pdf.path | |
end | |
end | |
if pdfs.count > 1 | |
system "gs -dBATCH -dNOPAUSE -q -sDEVICE=pdfwrite -sOutputFile=temp.pdf #{pdfs.join(' ')}" |
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
upstream myapp { | |
server unix:///myapp/tmp/puma.sock; | |
} | |
server { | |
listen 80; | |
server_name myapp.com; | |
# ~2 seconds is often enough for most folks to parse HTML/CSS and | |
# retrieve needed images/icons/frames, connections are cheap in |
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 ProtectedController << ApplicationController | |
before_filter :force_user | |
def index | |
end | |
private | |
def force_user | |
unless session[:user_id] | |
session[:redirect_url] = request.fullpath | |
redirect_to new_sessions_path |
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
click_link "Select" | |
page.execute_script("i = $('.select2-container input').first(); | |
i.val('"name of first optionin selection"').trigger('keyup');"); | |
find('.select2-results li:first-child').click | |
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 | |
### BEGIN INIT INFO | |
# Provides: unicorn | |
# Required-Start: $local_fs $remote_fs $network $syslog | |
# Required-Stop: $local_fs $remote_fs $network $syslog | |
# Default-Start: 2 3 4 5 | |
# Default-Stop: 0 1 6 | |
# Short-Description: starts the unicorn web server | |
# Description: starts unicorn |
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
sudo /etc/init.d/nginx stop | |
sudo /etc/init.d/nginx start |
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
wget -O init-deb.sh http://library.linode.com/assets/660-init-deb.sh | |
sudo mv init-deb.sh /etc/init.d/nginx | |
sudo chmod +x /etc/init.d/nginx | |
sudo /usr/sbin/update-rc.d -f nginx defaults |