Skip to content

Instantly share code, notes, and snippets.

View germanotm's full-sized avatar

Germano Teixeira de Miranda germanotm

  • Belo Horizonte, Brazil
View GitHub Profile
@leocomelli
leocomelli / git.md
Last active June 20, 2024 20:51
Lista de comandos úteis do GIT

GIT

Estados

  • Modificado (modified);
  • Preparado (staged/index)
  • Consolidado (comitted);

Ajuda

@fauxparse
fauxparse / date.coffee
Created December 21, 2011 23:20
CoffeeScript date utilities
Number::pad = (digits, signed) ->
s = Math.abs(@).toString()
s = "0" + s while s.length < digits
(if @ < 0 then "-" else (if signed then "+" else "")) + s
Date.months = [ "January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December" ]
Date.weekdays = [ "Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday" ]
Date.formats =
"a": -> Date.weekdays[@getDay()].substring(0, 3)
# this script will migrate and reorganize a Paperclip attachments directory to utilize :id_partition
# Quickly put together by mario@orbitalvoice.com
# Assumes that your images to migrate < 1 000 000
#
# Usage: ruby paperclip_partition_id_migrate.rb TARGET_DIR=/path/to/attachments/:class/:style
require '/opt/ruby-enterprise/lib/ruby/1.8/fileutils.rb'
def add_leading_zeros(i)