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
Deixar ferver e esperar 10 minutos. |
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
function git_state { | |
if [[ $(which git 2> /dev/null) ]] | |
then | |
local STATUS | |
local GIT_STATUS | |
GIT_STATE="" | |
STATUS=$(git status 2>/dev/null) | |
if [[ -z $STATUS ]] | |
then | |
return |
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 Bitly | |
def self.shorten url | |
Net::HTTP.start("api.bit.ly", 80) do |http| | |
request = http.get("/v3/shorten?#{required_params.merge(:longUrl => url).to_query}") | |
response = JSON.parse(request.body) | |
return response['data']['url'] if response['status_code'] == 200 | |
end | |
end |
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
<snippet> | |
<content><![CDATA[ | |
.modern { | |
display: inline-block; | |
margin: 10px; | |
padding: 8px 15px; | |
background: #B8ED01; | |
border: 1px solid rgba(0,0,0,0.15); | |
border-radius: 4px; | |
transition: all 0.3s ease-out; |
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
require 'json' | |
require 'mail' | |
Mail.defaults do | |
delivery_method :smtp, | |
{ address: "smtp.sendgrid.net", | |
port: 587, | |
domain: 'heroku.com', | |
user_name: ENV['SENDGRID_USERNAME'], | |
password: ENV['SENDGRID_PASSWORD'], |
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
alias st='git status' | |
alias pull='git pull origin master' | |
alias ci='git commit -m $1' | |
alias add='git add . ' | |
push(){ | |
if [ $# != 1 ] | |
then | |
git push origin master | |
else | |
git push $1 master |
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
<div class="fields"> | |
<%= f.text_field :number, placeholder: t('activerecord.attributes.phone.number') %> | |
<%= link_to_remove_fields t('remove'), f %><br /><br /> | |
</div> |
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 mongoose = require('mongoose'); | |
mongoose.Query.prototype.paginate = function(page, limit, callback) { | |
var query = this | |
, page = page || 1 | |
, limit = limit || 10 | |
, offset = (limit * page) - limit; | |
query = query.skip(offset).limit(limit); | |
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 Promise = require('mongoose').Promise | |
, promise = new Promise; | |
User.findById(_userId).exec(function(err, guy) { | |
if(err) { | |
promise.error(err); | |
return; | |
} |
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
$(function($) { | |
$(document).ready(function() { | |
var title = '' | |
, descr = ''; | |
$('#pictures ul li').each(function(index) { | |
title = $(this).find('img').prop('title'); | |
descr = $(this).find('img').data('description'); | |
if(title) { $(this).append('<h4>'+title+'</h4>'); } | |
if(descr) { $(this).append('<p>'+descr+'</p>'); } |
OlderNewer