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
Vamos colocar alguns snippets de código no Graffiti da HE:labs | |
https://www.dropcam.com/p/helabs | |
Sugira o seu que ele pode entrar na parede, mas tem que ser até final do dia 31 de março (terça)!! | |
Pode ser qualquer linguagem. | |
Ex: | |
while working{ | |
coffee++; | |
} |
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
Exemplo de `tag` no github | |
```ruby | |
codigo = Ruby.new(:param1,:param2) | |
# comentario | |
``` | |
```bash | |
$ export TOKEN=meutoken | |
$ ls -al |
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 | |
# script to screenshot the iPhone Simulator to the correct size | |
# to upload to iTunes Connect | |
# written by Jehiah Czebotar http://jehiah.cz/ | |
OUTPUTDIR=~/Desktop | |
TEMPFILE=iPhoneSimulatorScreenshot_`date +%Y%m%d_%H%M%S`.png | |
echo "output filename:\c" |
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 | |
free -m | grep Swap | while read output; | |
do | |
swap=$(echo $output | awk '{print $2}' ) | |
used=$(echo $output | awk '{ print $3 }' ) | |
freed=$(echo $output | awk '{ print $4 }' ) | |
echo "Swap : $swap" | |
echo "Used : $used" | |
echo "Free : $freed" | |
usep=`expr $used \* 100 / $swap` |
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 BankBillet | |
include HTTParty | |
include Virtus | |
base_uri 'https://app.cobregratis.com.br' | |
attribute :id, Integer | |
attribute :name, String | |
attribute :amount, Float | |
attribute :expire_at, Date | |
attribute :external_link, String |
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
# Joe Van Dyk discovered that running the Ruby garbage collector only every X seconds can speed up your tests. | |
# I found that deferring garbage collection would speed up my RSpec examples by about 15%, | |
# but it probably depends on the nature of your tests. | |
# https://makandracards.com/makandra/950-speed-up-rspec-by-deferring-garbage-collection | |
class DeferredGarbageCollection | |
RESERVED_IVARS = %w(@loaded_fixtures) | |
DEFERRED_GC_THRESHOLD = (ENV['DEFER_GC'] || 10.0).to_f | |
@@last_gc_run = Time.now | |
def self.start |
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
# It requires ACK - http://betterthangrep.com/ | |
task :find_unused_images do | |
images = Dir.glob('app/assets/images/**/*') | |
images_to_delete = [] | |
images.each do |image| | |
unless File.directory?(image) | |
# print "\nChecking #{image}..." | |
print "." | |
result = `ack -1 -G '(app|public)' --ruby --html --css --js #{File.basename(image)}` |
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
# -*- encoding : utf-8 -*- | |
require "spec_helper" | |
describe Notification do | |
describe "new_question" do | |
let(:user) { Factory.create(:user, name: 'Dart Vader', email: '[email protected]') } | |
let(:category) { Factory.create(:category, name: 'Saúde') } | |
let(:owner) { Factory.create(:user, name: 'Jaspion') } | |
let(:question) { Factory.create(:question, user: owner, category: category) } | |
let(:mailer) { Notification.new_question(question.id, user.id) } |
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
module AWS | |
module Core | |
class LogFormatter | |
# @param [Object] value | |
# @return [String] | |
def summarize_value value | |
case value | |
when String then summarize_string(value) | |
when Hash then '{' + summarize_hash(value) + '}' | |
when Array then summarize_array(value) |
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
+----------------------+-------+-------+---------+---------+-----+-------+ | |
| Name | Lines | LOC | Classes | Methods | M/C | LOC/M | | |
+----------------------+-------+-------+---------+---------+-----+-------+ | |
| Controllers | 130 | 117 | 13 | 20 | 1 | 3 | | |
| Helpers | 44 | 41 | 0 | 8 | 0 | 3 | | |
| Models | 241 | 218 | 9 | 31 | 3 | 5 | | |
| Libraries | 15 | 13 | 0 | 1 | 0 | 11 | | |
| Model specs | 696 | 676 | 0 | 0 | 0 | 0 | | |
| Controller specs | 455 | 430 | 0 | 6 | 0 | 69 | | |
| Helper specs | 126 | 121 | 1 | 0 | 0 | 0 | |
NewerOlder