Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View joselo's full-sized avatar

Jose Carrion joselo

View GitHub Profile
require 'mina/bundler'
require 'mina/rails'
require 'mina/git'
# require 'mina/rbenv' # for rbenv support. (http://rbenv.org)
require 'mina/rvm' # for rvm support. (http://rvm.io)
require 'mina/unicorn'
require 'mina/whenever'
# Basic settings:
# domain - The hostname to SSH to.
# Update, upgrade and install development tools:
apt-get update
apt-get -y upgrade
apt-get -y install build-essential
apt-get -y install git-core
# Install rbenv
git clone git://github.com/sstephenson/rbenv.git /usr/local/rbenv
# Add rbenv to the path:
@joselo
joselo / deploy.rb
Last active August 29, 2015 14:15 — forked from jbonney/deploy.rb
require 'mina/bundler'
require 'mina/rails'
require 'mina/git'
require 'mina/rvm'
# Usually mina focuses on deploying to one host and the deploy options are therefore simple.
# In our case, there is a number of possible servers to deploy to, it is therefore necessary to
# specify the host that we are targeting.
server = ENV['server']
# Since the same host can have multiple applications running in parallel, it is necessary to
@joselo
joselo / gist:ac67e69d1bcf18bb7967
Created May 23, 2015 00:48
Proxy webpack api
// package.jon
"scripts": {
"start": "webpack-dev-server --hot"
}
// webpack.config.js
module.exports = {
...
devServer: {
@joselo
joselo / gist:3284596ac6d7367e918c
Last active August 29, 2015 14:22
Backup and Restore a postgres database
# back the postgres database including the database name (create database... etc.)
pg_dump -C database > database.back
# restore the database
psql < database.back
# Rename database
ALTER DATABASE name RENAME TO new_name
@joselo
joselo / upload_pouch.js
Created September 3, 2015 23:28
Piece of code to upload file
function uploadFile(data, type) {
blobUtil.base64StringToBlob(data).then(function (blob) {
db.putAttachment($scope.ngDocId, $scope.attachmentId, $scope.ngModelRev, blob, type).then(function (result) {
$scope.ngModelRev = result.rev;
loadPreview();
}).catch(function (err) {
console.log(err);
});
#!/bin/sh
POSTGISCONTRIB_PATH=`pg_config --sharedir`/contrib
POSTGIS=$(find $POSTGISCONTRIB_PATH -name 'postgis.sql')
POSTGIS_COMMENTS=$(find $POSTGISCONTRIB_PATH -name 'postgis_comments.sql')
POSTGIS_SPATIAL=$(find $POSTGISCONTRIB_PATH -name 'spatial_ref_sys.sql')
if [ -z "$POSTGIS" ] || [ -z "$POSTGIS_SPATIAL" ]; then
echo " * Not found postgis contrib files."
exit 1
@joselo
joselo / Gemfile
Created April 23, 2011 01:34 — forked from rmoriz/Gemfile
UUID primary keys in Rails 3
# Gemfile
gem 'uuidtools'
@joselo
joselo / .bashrc
Created May 3, 2011 04:00
bashrc to support RVM, including the default bashrc file
if [[ -s "$HOME/.rvm/scripts/rvm" ]] ; then source "$HOME/.rvm/scripts/rvm" ; fi
if [[ ! -z "PS1" ]] ; then
# This is your .bashrc (renamed to .bashrc_part2)
source ~/.bashrc_part2
fi
@joselo
joselo / UserFilePreferences
Created May 5, 2011 01:31
My default UserFilePreferences for Sublime2 Editor
{
"color_scheme": "Packages/Color Scheme - Default/Solarized (Dark).tmTheme",
"file_exclude_patterns":
[
"*.png",
"*.gif",
".DS_Store",
".rspec",
"*sublime-project.sublime-project",
"config.ru",