Skip to content

Instantly share code, notes, and snippets.

View ricardodovalle's full-sized avatar

Ricardo do Valle ricardodovalle

  • São Paulo, Brazil
View GitHub Profile
@ricardodovalle
ricardodovalle / 1 setup vps
Created September 26, 2017 00:32 — forked from alekpopovic/1 setup vps
Deploy Rails 5.1.1 to VPS(Ubuntu 16.04.2 LTS). Nginx mainline + pagespeed, Puma with Jungle, Capistrano3, PostgreSQL 9.6, RVM, Certbot
root# apt-get update
root# apt-get upgrade
// dependencies for Ruby
root# apt-get install -y git-core curl zlib1g-dev build-essential libssl-dev libreadline-dev libyaml-dev \
libsqlite3-dev sqlite3 libxml2-dev libxslt1-dev libcurl4-openssl-dev python-software-properties libffi-dev \
libpcre3-dev unzip
// Node.js v7
root# curl -sL https://deb.nodesource.com/setup_7.x | sudo -E bash -
namespace('App.data')
###
Meteor pagination class
Usage
UsersController = RouteController.extend
waitOn: ->
@page = @params.query.page || 1
@pagination = new App.data.Pagination(Users, selector, {page: @page})
# This is a skeleton for testing models including examples of validations, callbacks,
# scopes, instance & class methods, associations, and more.
# Pick and choose what you want, as all models don't NEED to be tested at this depth.
#
# I'm always eager to hear new tips & suggestions as I'm still new to testing,
# so if you have any, please share!
#
# @kyletcarlson
#
# This skeleton also assumes you're using the following gems:
# derived from http://railscasts.com/episodes/340-datatables
# handles server side multi-column searching and sorting
class Datatable
delegate :params, :h, :raw, :link_to, :number_to_currency, to: :@view
def initialize(klass,view)
@klass = klass
@view = view
end
var Validations = (function(){
var Validation = function() {
var name = $("[name='nome']");
var email = $("[name='email']");
var empresa = $("[name='empresa']");
var telefone = $("[name='telefone']");
var mensagem = $("[name='mensagem']");
var regex = /^(([^<>()[\]\\.,;:\s@\"]+(\.[^<>()[\]\\.,;:\s@\"]+)*)|(\".+\"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;
#
# Para conseguir que compile os assets locais, depois
# de muito quebrar a cabeça, eu achei em um post de
# como escrever o deploy.rb para o Capistrano 3 esta
# pérola, que fez tudo 'ir para frente':
#
# "Entre as inovações do Cap3 está a descontinuação
# da sua DSL própria e a adoção do Rake"
#
# Então precisava somente saber como trocar uma task
# files_controller.rb
class FilesController < ApplicationController
def index
@files = Files.all
end
...
end
#/usr/bin/env bash
set -e
set -x
apt-get update
apt-get upgrade
apt-get -y install build-essential curl git-core openssl libreadline6 libreadline6-dev \
zlib1g zlib1g-dev libssl-dev libyaml-dev libsqlite3-0 libsqlite3-dev sqlite3 libxml2-dev \

Remove rbenv and any rubies, gems etc.:

$ rm -rf ~/.rbenv

Uninstall rbenv if installed via Homebrew

$ brew uninstall rbenv

Remove references to rbenv in ~/.bash_profile etc.

select.form-control + .chosen-container.chosen-container-single .chosen-single {
display: block;
width: 100%;
height: 34px;
padding: 6px 12px;
font-size: 14px;
line-height: 1.428571429;
color: #555;
vertical-align: middle;
background-color: #fff;