Skip to content

Instantly share code, notes, and snippets.

@chunlea
chunlea / input-group-in-simple-form.md
Last active October 5, 2021 20:03
How to use Boostrap 3 input-group in Simple Form

Finally, Simple Form support Boostrap 3. 👏

But I found it still dosen't support some components in Bootstrap 3. Or may be in the future. But I can't wait, so I find a solution to support them. It was inspired by heartcombo/simple_form#531 (comment) .

This is a final solution and I used in my project.

simple_form

@bagf
bagf / vagrant_precise32_install_php5.5.9.sh
Last active August 29, 2015 13:57
Downloads PHP 5.5.9 and builds it from source, then processed to use PECL to install memcache, libxl, openssl and gearman extensions
#!/bin/sh
echo "Installing php5 build dependencies..."
apt-get build-dep -q=2 php5
cd /tmp
# Get PHP
echo "Downloading and extracting php5.5.9 source..."
wget -q -O php5.5.9.tar.xz http://us2.php.net/get/php-5.5.9.tar.xz/from/this/mirror
tar xf php5.5.9.tar.xz
cd php-5.5.9/
@lemiorhan
lemiorhan / post-receive
Last active April 12, 2025 19:13
Post-receive hook to deploy the code being pushed to production branch to a specific folder
#!/bin/bash
target_branch="production"
working_tree="PATH_TO_DEPLOY"
while read oldrev newrev refname
do
branch=$(git rev-parse --symbolic --abbrev-ref $refname)
if [ -n "$branch" ] && [ "$target_branch" == "$branch" ]; then
@michelemina
michelemina / deploy.rb
Last active January 17, 2017 12:18
oracle client capistrano install task: useful when ruby-oci8 is required in a server
...
set :default_environment, {
'LD_LIBRARY_PATH' => "#{shared_dir}/oracle/"
}
@mdeous
mdeous / color.py
Created January 5, 2014 15:45
Python Shell Output Color
COLOR_CODES = {
'green': '\033[32m',
'bgreen': '\033[1;32m',
'bgrey': '\033[1;30m',
'reset': '\033[0m'
}
def color(text, color_name):
return COLOR_CODES[color_name]+text+COLOR_CODES['reset']
@brendanstennett
brendanstennett / steps
Last active December 19, 2019 12:08 — forked from trcarden/gist:3295935
Setting up SSL with Nginx and Unicorn
# SSL self signed localhost for rails start to finish, no red warnings.
# 1) Create your private key (any password will do, we remove it below)
$ openssl genrsa -des3 -out server.orig.key 2048
# 2) Remove the password
$ openssl rsa -in server.orig.key -out server.key
@XORwell
XORwell / simple_form_bootstrap.rb
Last active September 3, 2018 05:15
bootstrap 3 simple_form wrappers
# http://stackoverflow.com/a/18684021
# Bootstrap 3
inputs = %w[
CollectionSelectInput
DateTimeInput
FileInput
GroupedCollectionSelectInput
NumericInput
PasswordInput
RangeInput
@nextofsearch
nextofsearch / gist:6497091
Created September 9, 2013 15:20
deploy.rb for capistrano
require 'bundler/capistrano'
require 'capistrano-unicorn'
set :stages, %w(production staging)
set :default_stage, "staging"
require 'capistrano/ext/multistage'
# set :env, fetch(:env, "production")
set :application, "tp"
@robmiller
robmiller / .gitconfig
Created July 17, 2013 07:52
Some useful Git aliases that I use every day
#
# Working with branches
#
# Get the current branch name (not so useful in itself, but used in
# other aliases)
branch-name = "!git rev-parse --abbrev-ref HEAD"
# Push the current branch to the remote "origin", and set it to track
# the upstream branch
publish = "!git push -u origin $(git branch-name)"
@JamesDullaghan
JamesDullaghan / digitalocean.md
Created July 6, 2013 20:54
Deploy rails app to digitalocean with nginx, unicorn, capistrano & postgres

Deploy Rails app to digitalocean with nginx, unicorn, capistrano & postgres

Create droplet of your liking (ubuntu 12.10 x32)

ssh to root in terminal with your server ip

ssh [email protected]

Add ssh fingerprint and enter password provided in email