Skip to content

Instantly share code, notes, and snippets.

View mdamaceno's full-sized avatar
🇧🇷

Marco Damaceno mdamaceno

🇧🇷
View GitHub Profile
@mdamaceno
mdamaceno / gist:3f76b506ecaf8a244fd7
Last active August 29, 2015 14:05
Usual commands in Ruby on Rails
#####################################
#Rails Console
#####################################
# ** Update a user **
u = User.find(id)
u.update_attribute :column, value
# ** Insert a new a user (Devise) **
#!/bin/sh
echo "------------------------------------------------------"
echo " Initial Configuration Ubuntu: By Marco Damaceno "
echo "------------------------------------------------------"
# System upgrade
echo "Updating repositories and upgrading system"
sudo apt-get update
sudo apt-get upgrade -y
sudo apt-get dist-upgrade -y
clear
@mdamaceno
mdamaceno / inputs.js
Created September 17, 2014 20:48
Formato campos
"<input class='hidden' type='hidden' id='demand_item' name='demand[item][]' value='" + item + "'>" +
"<input class='hidden' type='hidden' id='demand_product_id' name='demand[product_id][]' value='" + product + "'>" +
"<input class='hidden' type='hidden' id='demand_collection_id' name='demand[collection_id][]' value='" + collection + "'>" +
"<input class='hidden' type='hidden' id='demand_color_id' name='demand[color_id][]' value='" + color + "'>" +
"<input class='hidden' type='hidden' id='demand_quantity' name='demand[quantity][]' value='" + quantity + "'>" +
"<input class='hidden' type='hidden' id='demand_width' name='demand[width][]' value='" + width + "'>" +
"<input class='hidden' type='hidden' id='demand_height' name='demand[height][]' value='" + height + "'>" +
"<input class='hidden' type='hidden' id='demand_model_id' name='demand[model_id][]' value='" + model + "'>" +
"<input class='hidden' type='hidden' id='demand_completion_id' nam
@mdamaceno
mdamaceno / sublimesettings
Created November 19, 2014 12:14
Sublime User Settings
{
"auto_complete_selector": "text.html.erb, source - comment, meta.tag - punctuation.definition.tag.begin",
"bold_folder_labels": false,
"caret_extra_width": 1,
"caret_style": "phase",
"close_windows_when_empty": false,
"color_scheme": "Packages/Dayle Rees Color Schemes/legacy/Turnip.tmTheme",
"detect_indentation": false,
"drawCentered": true,
"draw_minimap_border": true,
@mdamaceno
mdamaceno / sublime-settings
Created March 20, 2015 14:49
Sublime Settings
{
"auto_complete_selector": "text.html.erb, source - comment, meta.tag - punctuation.definition.tag.begin",
"bold_folder_labels": false,
"caret_extra_width": 1,
"caret_style": "phase",
"close_windows_when_empty": false,
"color_scheme": "Packages/Boron Color Scheme/Boron.tmTheme",
"detect_indentation": false,
"drawCentered": true,
"draw_minimap_border": true,
{
"estados": [
{
"sigla": "AC",
"nome": "Acre",
"cidades": [
"Acrelândia",
"Assis Brasil",
"Brasiléia",
"Bujari",
@mdamaceno
mdamaceno / testesavon.rb
Last active December 1, 2015 04:56
Example using WSDL in Ruby
require 'savon'
client = Savon.client(wsdl: 'http://tadeuclasse.zz.mu/WSCartao/Server.php?wsdl')
response = client.call(:validar_cartao, message: {
tDadosCartao: {
"NumeroCartao" => "4522669988574455",
"Codigo" => "168",
"NomeCliente" => "Marco Damaceno",
"Validade" => "201612",
"Valor" => "150",
@mdamaceno
mdamaceno / 660-init-deb.sh
Created September 4, 2015 12:09 — forked from rschmitty/660-init-deb.sh
Linode script to register nginx after passenger install http://library.linode.com/assets/660-init-deb.sh
#! /bin/sh
### BEGIN INIT INFO
# Provides: nginx
# Required-Start: $all
# Required-Stop: $all
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: starts the nginx web server
# Description: starts nginx using start-stop-daemon
@mdamaceno
mdamaceno / ruby-observer.rb
Last active September 30, 2015 00:44
Observer Pattern in Ruby
require "observer"
class Ticker ### Periodically fetch a stock price.
include Observable
def initialize(symbol)
@symbol = symbol
end
def run

Instalar Nginx

sudo apt-get update
sudo apt-get install nginx

Ver se Nginx está funcionando corretamente

Digite no navegador: