Skip to content

Instantly share code, notes, and snippets.

View caarlos0's full-sized avatar
🍄

Carlos Alexandro Becker caarlos0

🍄
View GitHub Profile
@carlosspohr
carlosspohr / README.md
Last active August 31, 2023 00:35
Functional Apache2 route for Gitlab 5.0

For your Ruby, you'll must install this gems:

sudo gem install passenger

sudo passenger-install-apache2-module

At this moment, you'll asked to install some Apache2's deps (three deps):

sudo apt-get install apache2-prefork-dev

@egonSchiele
egonSchiele / rons.rb
Last active October 30, 2022 06:16
The dining philosophers problem in Ruby, solved using the resource hierarchy solution
require 'thread'
class Ron
def initialize(name, left_fork, right_fork)
@name = name
@left_fork = left_fork
@right_fork = right_fork
while true
think
dine
@egonSchiele
egonSchiele / dining.rb
Last active September 22, 2018 12:23
Dining philosophers in Ruby with Celluloid. Modified from https://gist.github.com/bugant/4984042
require 'rubygems'
require 'celluloid'
class Waiter
include Celluloid
FORK_FREE = 0
FORK_USED = 1
attr_reader :philosophers
attr_reader :forks
attr_reader :eating
@rodrigobaron
rodrigobaron / mvps_hosts.sh
Created May 29, 2013 12:25
Block ads .. banner and another shits ..
# -*- coding: UTF-8 -*- # ###################################################
# #
# mvps_hosts - Sync MVPS HOSTS #
# #
# DESCRIPTION #
# The Sync MVPS HOSTS backup your hosts file ... download the mvps hosts #
# and join into the new hosts file... if you need add or remove a custom host #
# change the older file "/etc/hosts_bak" #
# #
# REQUERIMENT #
var itens = [
'apple',
'grape',
'orange'
];
itens
.join(',')
.replace(/(\w+(?!=\,))/g, '<li>\$1<\li>')
.split(',');
@burke
burke / remotepaste.md
Last active November 10, 2025 16:09
This sets up keybindings in tmux that allow you to copy/paste to/from your OS X clipboard from tmux running inside an SSH connection to a remote host. Partially borrowed from http://seancoates.com/blogs/remote-pbcopy

Local (OS X) Side

~/Library/LaunchAgents/pbcopy.plist

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
     <key>Label</key>
     <string>localhost.pbcopy</string>
$ = jQuery
$.fn.lineHeight or= ->
if height = @data('lineHeight')
return height
# Create a hidden div with the same font
# properties, then measure its height
$shadow = $('<span />')
$shadow.css({
@gmcoringa
gmcoringa / CommitsRegulares.md
Last active December 20, 2015 13:29
Commits Regulares

##Commits Regulares

Commits Regulares baseiam-se na prática de comitar suas alterações regularmente no controle de versão, ou seja, no mínimo uma vez por dia. Desta forma as alterações são disponibilizadas para outros desenvolvedores em partes, o que facilita o uso de outras praticas, como code review, integração continua, etc.

####Pontos de Atenção

Porém, desenvolvedores devem ter cuidado sobre os efeitos de seus comits, se planejando melhor, e as vezes fazendo uso de tecnicas, como configurações para habilitar e desativar uma funcionalidade.

####Porque comitar regularmente

@carlosspohr
carlosspohr / Charlao.txt
Last active December 20, 2015 23:48
Causos
Teve um maluco aqui em medianeira que atropelou um cara cagando no começo da manhã.
O cara vinha bêbado de moto e passou direto na rua da rodovia e entrou num matinho e
deu no meio de um cara cagando lá.
Resultado: um cara todo cagado com a perna quebrada e o atropelador caído dentro umas
manilhas da sanepar...e o atropelador teve que pagar um ano de seguro desemprego pro
atropelado ainda :D
-- Maconha pro morcego
class Module
def dispatch(*klasses, last)
last_klass, mid = last.first
klasses << last_klass
__dispatch_list << [klasses, instance_method(mid)]
define_method(mid, __dispatch_proc(__dispatch_list))
end
def __dispatch_list
@__dispatch_list ||= []