Skip to content

Instantly share code, notes, and snippets.

View halan's full-sized avatar
🛹

Halan Pinheiro halan

🛹
View GitHub Profile
@halan
halan / links.textile
Created November 13, 2012 16:03 — forked from lucashungaro/links.textile
Links de referência utilizados em minha palestra
@halan
halan / gist:4171492
Created November 29, 2012 20:01 — forked from cesarmedeiros/gist:4171441
Sugestão de leituras com base no Tracking de leituras anteriores
require 'rubygems'
require 'redis'
class Datanosql
def initialize
@r = Redis.new
end
@halan
halan / .vimrc
Created April 4, 2013 17:40 — forked from brennovich/.vimrc
set nocompatible
filetype off
set rtp+=~/.vim/bundle/vundle/
call vundle#rc()
" let Vundle manage Vundle
" required!
Bundle 'gmarik/vundle'

Awesome PHP

A list of amazingly awesome PHP libraries, resources and shiny things.

Composer

Composer Related

Awesome PHP

A list of amazingly awesome PHP libraries, resources and shiny things.

Composer

Composer Related

class String
ACCENTED_VOWELS = "áàãâäéèêëíìîïóòõôöúùûüçÁÀÃÂÄÉÈÊËÍÌÎÏÓÒÕÔÖÚÙÛÜÇ"
UNACCENTED_VOWELS = "aaaaaeeeeiiiiooooouuuucAAAAAEEEEIIIIOOOOOUUUUC"
def unaccentize
self.tr ACCENTED_VOWELS, UNACCENTED_VOWELS
end
end
require 'delegate'
class AbandonedTrialQuery < SimpleDelegator
def initialize(relation = Account.scoped)
super(relation.where(plan: nil, invites_count: 0))
end
end
1. Two space soft indents (fake tabs) OR tabs... BUT NEVER BOTH - DO NOT MIX
2. Whitespace, Parens, Braces, Linebreaks
if/else/for/while/try always have spaces, braces and multiple lines.
--------------------------------------------------------------------
define 'components/singleton', [], ->
###
Singleton class
###
class Singleton extends Backbone.View
# @static
@getInstance = ->
@_instance = new @ unless @_instance?
@_instance
@halan
halan / gist:734b5380baa1502aa887b3f9902f8ea6
Created June 5, 2016 04:15
Ruby AES Encryption using OpenSSL
#!/usr/bin/env ruby
require "openssl"
require 'digest/sha2'
require 'base64'
# We use the AES 256 bit cipher-block chaining symetric encryption
alg = "AES-256-CBC"
# We want a 256 bit key symetric key based on some passphrase
digest = Digest::SHA256.new