Skip to content

Instantly share code, notes, and snippets.

View joselo's full-sized avatar

Jose Carrion joselo

View GitHub Profile
sudo /usr/local/mysql/support-files/mysql.server start
sudo /usr/local/mysql/support-files/mysql.server stop
sudo /usr/local/mysql/support-files/mysql.server restart
@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);
});
@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 / 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 / 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
# 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:
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.
@joselo
joselo / gist:8682432
Created January 29, 2014 05:38
Kaminari Pagination Methods
current_page
first_page?
last_page?
max_per_page
next_page
num_pages
prev_page
total_pages
total_count
@joselo
joselo / gist:8421582
Created January 14, 2014 16:53
Get started with Git and Github very basic tutorial
Github Notes
Site: http://github.com
Repository: https://github.com/joselo/arupo
Working with Git Branches on Github
1) Create a change to new branch
$ git checkout -b cipre
2) Make changes etc.
@joselo
joselo / app.js
Created January 5, 2014 06:52
How to user a resolver to check if a user is signed in
'use strict';
angular.module('instafacApp', [
'ngCookies',
'ngResource',
'ngSanitize',
'ngRoute'
])
.config(function ($routeProvider, $httpProvider){