Skip to content

Instantly share code, notes, and snippets.

View jogaco's full-sized avatar
🎯
Focusing

J. Garcia jogaco

🎯
Focusing
View GitHub Profile
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
@linjunpop
linjunpop / README.md
Created August 21, 2012 01:15
Rails flash messages with AJAX requests
@chuckbjones
chuckbjones / deploy.rb
Created August 22, 2012 07:51
Generate static html files at deploy time in Rails 3.x
# define a method to run rake tasks
def run_rake(task, options={}, &block)
rake = fetch(:rake, 'rake')
rails_env = fetch(:rails_env, 'production')
command = "cd #{current_path} && #{rake} #{task} RAILS_ENV=#{rails_env}"
run(command, options, &block)
end
@multiplier
multiplier / gist:3631239
Created September 5, 2012 05:50 — forked from 23inhouse/gist:3594808
Customizing simple_form and bootstrap

Customization

  <%= f.input :state, :collection => ['SA', 'WA'] %>
  <%= f.input :state,
              :as => :radio_buttons,
@alicial
alicial / amz-s3-bucket-policy
Created September 13, 2012 18:26
Amazon S3 Bucket Policy to prevent hot linking
{
"Version": "2008-10-17",
"Id": "0c762de8-f56b-488d-a4a4-20d1cb31df2f",
"Statement": [
{
"Sid": "Allow in my domains",
"Effect": "Allow",
"Principal": {
"AWS": "*"
},
@kehh
kehh / warsync.sh
Created October 31, 2012 08:03
Warsync - a tool for speeding up rsync of war files by unzipping them on the source and target and then rsyncing the diffs
#!/bin/bash
#Warsync - a tool for speeding up rsync of war files by unzipping them on the source and target and then rsyncing the diffs
echo "Usage: $0 source.war destinationserver"
CURRENTDIR=$PWD
WARFILE="$CURRENTDIR/$1"
REMOTEHOST=$2
CURRENTUSER=$USER
REMOTEHOME="/home/$CURRENTUSER"
WARFILENAME=`basename $1`
echo "source is $WARFILE target is $TARGET"
@scottkf
scottkf / config-deploy.rb
Created December 18, 2012 17:51
Puma capistrano deployment script, w/init.d script and nginx conf
require "bundler/capistrano"
server "server", :web, :app, :db, primary: true
set :application, "<application>"
set :user, "<user>"
set :group, "wheel"
set :deploy_to, "/home/#{user}/apps/#{application}"
set :deploy_via, :remote_cache
set :use_sudo, false
@adamloving
adamloving / temporary-email-address-domains
Last active July 9, 2025 03:03
A list of domains for disposable and temporary email addresses. Useful for filtering your email list to increase open rates (sending email to these domains likely will not be opened).
0-mail.com
0815.ru
0clickemail.com
0wnd.net
0wnd.org
10minutemail.com
20minutemail.com
2prong.com
30minutemail.com
3d-painting.com
@cpuguy83
cpuguy83 / loading_spinner.coffee
Last active August 30, 2020 13:49
Simple loading spinner for long requests with turbolinks and bootstrap modal
@PageSpinner =
spin: (ms=500)->
@spinner = setTimeout( (=> @add_spinner()), ms)
$(document).on 'page:change', =>
@remove_spinner()
spinner_html: '
<div class="modal hide fade" id="page-spinner">
<div class="modal-head card-title">Please Wait...</div>
<div class="modal-body card-body">
<i class="icon-spinner icon-spin icon-2x"></i>
@timwasson
timwasson / Twitter Bootstrap dynamic image modal
Created February 22, 2013 21:08
For users of the fantastic Twitter Bootstrap, this will dynamically create a modal dialog for an image when you've got an <a> with the class of "modal-dialog". The image should have a data-attribute of "data-full-size". The image's alt attribute is used for the modal title. This is quick and dirty, but hopefully useable.
//Sample HTML to use
<a class="modal-dialog"><img src="thumb.png" alt="Image Title" data-full-size="full-size.png"></a>
// Look for modal pop-ups
var modalPops = $("a.modal-dialog");
//If there's modals, inject all the necessary code.
if(modalPops.length) {
//First add the data attributes