Skip to content

Instantly share code, notes, and snippets.

View dsbraz's full-sized avatar

Daniel Braz dsbraz

View GitHub Profile
@dsbraz
dsbraz / gist:8a35fd5589c00ee9fc54
Created April 25, 2015 02:11
Multiselect dropdown no Excel
Private Sub Worksheet_Change(ByVal Target As Range)
Dim rngDV As Range
Dim oldVal As String
Dim newVal As String
If Target.Count > 1 Then GoTo exitHandler
On Error Resume Next
Set rngDV = Cells.SpecialCells(xlCellTypeAllValidation)
On Error GoTo exitHandler
@dsbraz
dsbraz / Rsk
Created September 25, 2014 20:47
require 'eventmachine'
require 'redis'
require 'amqp'
EventMachine.run do
EventMachine.start_server '127.0.0.1', 8080 do |c|
def c.receive_data(data)
redis = Redis.new
connection = AMQP.connect(:host => '127.0.0.1')
channel = AMQP::Channel.new(connection)
@dsbraz
dsbraz / Postgresql UTF-8
Last active August 29, 2015 14:03
Postgresql UTF-8
# sudo su - postgres
# createuser -s -r vagrant
# psql
# UPDATE pg_database SET datistemplate=FALSE WHERE datname='template1';
# DROP DATABASE template1;
# CREATE DATABASE template1 WITH owner=postgres encoding='UTF-8'
lc_collate='en_US.utf8' lc_ctype='en_US.utf8' template template0;
# UPDATE pg_database SET datistemplate=TRUE WHERE datname='template1';
@dsbraz
dsbraz / Vagrantfile
Created December 4, 2013 20:46
Vagrant com provisionamento via Ruby code
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
config.vm.provision "shell", path: "provision.rb"
end
@dsbraz
dsbraz / gist:5385622
Created April 15, 2013 04:00
Notification's Spike => EventMachine + WebSocket + Redis (PubSub)
require 'rubygems'
require 'em-websocket'
require 'sinatra/base'
require 'thin'
require 'redis'
require 'json'
require 'pry'
# SOCKETS = []
@dsbraz
dsbraz / gist:1615889
Created January 15, 2012 13:40
Servidor de Desenvolvimento: Instalação Comando-a-Comando
# Apache + PHP + MySQL + RVM + Ruby + Passenger
# Instalação comando-a-comando
# Apache + PHP + MySQL
apt-get install tasksel
tasksel install lamp-server
# RVM
C#
10.downto(0).do(
() => Console.WriteLine("0")
);
10.times (
i => Console.WriteLine(i)
);
Java