This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Tested on Rails 4.0.4 | |
# Rails 4.1.0.rc2 has fixed it. | |
require 'active_record' | |
ActiveRecord::Base.establish_connection adapter: "sqlite3", database: ":memory:" | |
ActiveRecord::Migration.create_table :library | |
ActiveRecord::Migration.create_table :books do |t| | |
t.string :name |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module ActiveRecord | |
module Querying | |
delegate :group_date, :to => :scoped | |
end | |
module QueryMethods | |
def group_date(column_name = nil) | |
return self if column_name.blank? | |
# Rails uses a non standard time zone naming. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class BrPhoneValidator < ActiveModel::EachValidator | |
# first 2 digits represent dialing code | |
# dialing codes in Brazil don't start with 0 | |
# | |
# the following represent the phone | |
# must have 8 digits | |
# first digit must start with 2, 3, 4, 5 or 6 | |
# | |
LANDLINE_REGEXP = /\A[1-9]\d[2-6]\d{7}\z/ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# first 2 digits represent dialing code | |
# dialing codes in Brazil don't start with 0 | |
# | |
# the following represent the phone | |
# must have 8 digits | |
# might have 9 if dialing code is 11, 12, 13, 14, 15, 16, 17, 18 or 19 | |
# http://g1.globo.com/sao-paulo/noticia/2013/08/nono-digito-comeca-valer-para-telefones-celulares-do-interior-paulista.html | |
# first digit must start with 7, 8 or 9 | |
# might start with 5 as well if dialing code is 11 | |
# |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
a[target] { | |
display: inline; | |
} | |
a[target]::before { | |
content: "this is a link => "; | |
margin: 0 4px 0 2px; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
a[target]::before { | |
content: "this is a link => "; | |
margin: 0 4px 0 2px; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
a::before { | |
content: "this is a link => "; | |
margin: 0 4px 0 2px; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"name": "awesome-project", | |
"version": "0.1.0", | |
"dependencies": { | |
"mysecretproject": "https://dl.dropbox.com/s/randomcharshere/mysecretproject.tar.gz?dl=1" | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
GIT_REPO="/path/to/git/repo" | |
cd $GIT_REPO | |
git archive --format=tar --prefix=package/ master | gzip > ~/Dropbox/repo.tar.gz && open ~/Dropbox | |
echo "Now generate the Dropbox link and add it to package.json." |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var Car | |
, prius | |
; | |
Car = function(b, m, y) { | |
this.brand = b; | |
this.model = m; | |
this.year = y; | |
}; |
NewerOlder