Skip to content

Instantly share code, notes, and snippets.

@piscisaureus
piscisaureus / pr.md
Created August 13, 2012 16:12
Checkout github pull requests locally

Locate the section for your github remote in the .git/config file. It looks like this:

[remote "origin"]
	fetch = +refs/heads/*:refs/remotes/origin/*
	url = [email protected]:joyent/node.git

Now add the line fetch = +refs/pull/*/head:refs/remotes/origin/pr/* to this section. Obviously, change the github url to match your project's URL. It ends up looking like this:

@kazpsp
kazpsp / passwords_controller.rb
Created August 14, 2012 16:40 — forked from guilleiguaran/passwords_controller.rb
StrongParameters with Devise
# app/controllers/users/password_controller.rb
class Users::PasswordsController < Devise::PasswordsController
def resource_params
params.require(:user).permit(:email, :password, :password_confirmation)
end
private :resource_params
end
@chilts
chilts / gist:3687910
Created September 9, 2012 23:29 — forked from twhid/gist:2648062
grunt task to deploy JS files to S3 with awssum
grunt.registerMultiTask('s3deploy', 'deploy to S3 using awssum', function () {
// dependencies
var awssum = require('awssum'),
fs = require('fs'),
path = require('path'),
aws = require('./settings').aws;
var amz = awssum.load('amazon/amazon'),
AmazonS3 = awssum.load('amazon/s3'),
s3 = new AmazonS3({
@wlangstroth
wlangstroth / deploy.rb
Last active September 11, 2021 13:15
Capistrano + Nginx + Unicorn + Sinatra on Ubuntu
require 'bundler/capistrano'
set :application, "net"
set :repository, "[email protected]:net.git"
set :scm, :git
set :default_environment, {
'PATH' => "$HOME/.rbenv/shims:$HOME/.rbenv/bin:$PATH"
}
@chen206
chen206 / gist:4030441
Created November 7, 2012 09:45
Install Postgresql 9.2 on Ubuntu 12.04
#!/bin/bash
#
# Install Postgres 9.2 on a clean Ubuntu 12.04
"""
LC_ALL issue
comment out the AcceptEnv LANG LC_* line in the remote /etc/ssh/sshd_config file.
sudo apt-get install language-pack-en-base
sudo dpkg-reconfigure locales
comment out the SendEnv LANG LC_* line in the local /etc/ssh/ssh_config file.
@kxhitiz
kxhitiz / vps_deployement
Last active October 13, 2015 06:48
deployment commands
Requires Ruby 1.9.2 or higher.
## Local Commands
```
rails new blog -d postgresql
rails g scaffold article name content:text
# setup server (below) with "ssh [email protected]"
@hoffmanc
hoffmanc / Gemfile
Created December 7, 2012 21:00
Dwolla Active Merchant Integration Example
# added
gem 'activemerchant'
@christophercliff
christophercliff / Makefile
Created December 14, 2012 00:19
Makefile for deploying a Wintersmith static site to Github Pages without exposing the source (assumes you're using the default build directory).
deploy:
rm -rf ./build
wintersmith build
cd ./build && \
git init . && \
git add . && \
git commit -m "Deploy"; \
git push "[email protected]:{YOUR NAME}/{YOUR REPO}.git" master:gh-pages --force && \
rm -rf .git
@mhemesath
mhemesath / async_task_middleware.py
Last active May 12, 2022 19:17
MIddleware to allow celery tasks to be batched per request.
from celery import task
class AsyncTaskMiddleware(object):
"""
Dynamically adds an async task queue to the request to be executed when the
response is processed.
All tasks added to the request are executed using a single asynchronous celery task.
Once the task is executed, it will execute each individual task in its own celery
task.
<form method="post" action="https://gateway.pagosonline.net/apps/gateway/index.html" id="pagosonline_form" name="pagosonline_form">
<input type="hidden" name="descripcion" value="{$p.gtitle|stripslashes}" />
<input type="hidden" name="valor" value="{$value[1]}" id='povalue'/>
<input type="hidden" name="usuarioId" value="{$login}" />
<input type="hidden" name="moneda" value="COP" />
<input name="lng" type="hidden" value="es">
<input name="iva" type="hidden" value="0.00">
<input name="baseDevolucionIva" type="hidden" value="0.00">
<input type="hidden" name="emailComprador" value="{$emailcomprador}" />
<input type="hidden" name="url_respuesta" value="{$baseurl}/thank_you?g={$eid}" /> <!--Url where user is returned-->