Skip to content

Instantly share code, notes, and snippets.

View tinogomes's full-sized avatar
😀

Celestino Gomes tinogomes

😀
View GitHub Profile
@tinogomes
tinogomes / README.md
Created September 30, 2016 23:42
Custom Package Control repositories
@tinogomes
tinogomes / application_controller.rb
Created March 29, 2016 04:52
Declaring helper_method before def
class ApplicationController < ActionController::Base
helper_method \
def current_user
# some stuff
end
end
@tinogomes
tinogomes / redis-copy
Created December 15, 2015 23:23
Shell script to copy redis keys between redis servers
#!/bin/sh
function usage() {
echo "Usage: $0 <source_redis> <destination_redis> <key_pattern>"
echo " <source_redis> - Source server hostname"
echo " <destination_redis> - Destination server nostname"
echo " <key_pattern> - Keys to copy (Like Redis KEYS pattern)"
exit 0
}
require 'benchmark/ips'
GC.disable
CYCLES = 1_000_000
SINGLE_QUOTES = 'string'
DOUBLE_QUOTES = "string"
Benchmark.ips do |x|
x.report('double quotes') { b = DOUBLE_QUOTES }
x.report('single quotes') { a = SINGLE_QUOTES }
@tinogomes
tinogomes / lista.md
Last active September 16, 2020 00:13
Mecânico, Lojas e peças - Vectra 1994

Mecânico

  • Auto Mecânica DJM - 2401-6625 - Maurício

Auto peças

  • ABLANCA - 3332-0030
  • IVAN - 2401-7161
  • Fontenele Celestino - 2401-6926
  • lucas - 2401-7412 / 2401-7299
@tinogomes
tinogomes / app_config.rb
Last active August 29, 2015 14:08
config/initializers/app_config.rb - load all config/*.yml files at APP_CONFIG
conf_files = Dir[Rails.root.join('config/*.yml')]
if conf_files.any?
configs = {}
conf_files.each do |filename|
key_name = File.basename(filename).gsub(File.extname(filename), '')
begin
configuration = YAML.load_file(filename)[Rails.env]
@tinogomes
tinogomes / gist:193389e167c34ee16f78
Created October 29, 2014 18:43
configuração de app no nginx para rails server simples
upstream app_server {
server 127.0.0.1:3000;
}
server {
listen local.app.com:80;
server_name local.app.com;
access_log /var/log/nginx/access.log;
error_log /var/log/nginx/error.log;
@tinogomes
tinogomes / gist:7ca162a0110be69a4a64
Last active February 7, 2025 13:37
Frases - Porta dos Fundos - Mundo dos Negócios

https://www.youtube.com/watch?v=cPbl26Fw-dk

  • Quer brincar de Eike Bastista nessa porra!
  • Matar um leão por dia.
  • Faca nos dentes
  • Sangue no olho
  • É matar ou morrer
  • Dando muque em macaco de gaveta
  • É largar mato na caçamba
  • Jogar terra na boca de carrapato
@tinogomes
tinogomes / gist:ad13bb3f4e9f95aec81e
Last active August 29, 2015 14:02
Convert YouTube link to linkYouTube bookmark

Copy

linkYU

BANK_RULES ||= YAML::load(ERB.new(File.read(Rails.root.join('bank_rules.yml'))).result)
BANK_RULES.default = BANK_RULES['default']
def BANK_RULES.[](key, attribute = nil)
attributes = super(key)
return attributes if attribute.nil?
attributes[attribute]
end
class Bank