This file contains 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
┌── info ──────────────────────────────┐ | |
J-_-L │ http://github.com/janlelis/clipboard │ | |
├── usage ─────────────────────────────┤ | |
│ require 'clipboard' │ | |
│ Clipboard.copy '42' │ | |
│ Clipboard.paste #=> 42 │ | |
└──────────────────────────────────────┘ |
This file contains 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 User < ActiveRecord::Base | |
validates :username, presence: :true | |
validates :password_digest, presence: :true | |
has_secure_password | |
end |
This file contains 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
/*! normalize.css v3.0.2 | MIT License | git.io/normalize */ | |
html { | |
font-family: sans-serif; | |
-ms-text-size-adjust: 100%; | |
-webkit-text-size-adjust: 100%; | |
} | |
body { | |
margin: 0; | |
} |
This file contains 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 Model < ActiveRecord::Base | |
def self.search(term) | |
words = sanitize(term.parameterize(" ").scan(/\w+/) * "+") | |
where("name @@ to_tsquery('portuguese', #{words})") | |
end | |
end |
This file contains 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
require 'rails_helper' | |
describe BookCreator do | |
context 'create a book by isbn' do | |
before do | |
VCR.use_cassette('search-isbn') do | |
book | |
end | |
end |
This file contains 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/bash | |
### BEGIN INIT INFO | |
# Provides: nginx | |
# Required-Start: $all | |
# Required-Stop: $all | |
# Default-Start: 2 3 4 5 | |
# Default-Stop: 0 1 6 | |
# Short-Description: starts the nginx web server | |
# Description: starts nginx | |
### END INIT INFO |
This file contains 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 ApplicationController < ActionController::Base | |
protect_from_forgery :with => :exception | |
helper_method :categories_ordered | |
def categories_odered | |
Category.order(:name) | |
end | |
end |
This file contains 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 HomeController < ApplicationController | |
def foo | |
render layout: false | |
end | |
end |
This file contains 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 | |
NAME=$(basename $0) | |
dbprefix=${HOME}/Data/mongodb | |
mkdir -p "${dbprefix}/db" >/dev/null 2>/dev/null | |
repair() { | |
mongod --repair --dbpath ${dbprefix}/db |
This file contains 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
# Passos: | |
% wget -c http://fastdl.mongodb.org/linux/mongodb-linux-x86_64-2.0.3.tgz | |
tar xfz mongodb-linux-x86_64-2.0.3.tgz | |
mkdir -p ${HOME}/db | |
./mongodb-linux-x86_64-2.0.3/bin/mongod run --dbpath ${HOME}/db |
OlderNewer