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
// remove all local branches except from the ones that exist in remote | |
git fetch --all -p; git branch -vv | grep ": gone]" | awk '{ print $1 }' | xargs -n 1 git branch -D |
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
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="utf-8"> | |
<meta name="viewport" content="width=device-width"> | |
<title>JS Bin</title> | |
</head> | |
<body> | |
<script id="jsbin-javascript"> |
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
git commit -m “Release 0.0.1” | |
git tag v0.0.1 | |
git push origin master --tags | |
npm publish |
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 | |
module Findable | |
def find_by_name(name) | |
# find something | |
end | |
end | |
# Class | |
class Klass | |
# class stuff |
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 Atbash | |
LETTERS = %w(A B C D E F G H I J K L M N O P Q R S T U V W X Y Z) | |
NUMBERS = %w(0 1 2 3 4 5 6 7 8 9) | |
PUNCTUATION = [' ', ',', '.'] | |
def self.encode(str) | |
cipher = [] | |
str.chars.each do |char| | |
next if PUNCTUATION.include?(char) |
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
months = { January: 31, February: 28, March: 31, April: 30, May: 31, June: 30, July: 31, August: 31, September: 30, October: 31, November: 30, December: 31 } | |
months.each_with_index do |(key, val), i| | |
puts "#{i}: #{key} has #{val} days" | |
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
lang = 'en' | |
welcome_msg = case lang | |
when 'en' then 'welcome' | |
when 'de' then 'willkommen' | |
when 'fr' then 'bienvenue' | |
when 'de' then 'bienvenida' | |
else 'yo' | |
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
def yo | |
if block_given? | |
yield | |
else | |
puts "No block :-(" | |
end | |
end | |
yo # => No block :-( | |
yo { puts "Yo man" } # => Yo man |
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
def hello(name = "world") | |
puts "hello #{name}!" | |
end | |
hello # => hello world! | |
hello('John') # => hello John! |
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
(1..10) === 4 # => true | |
(1...10) === 10 # => false |
NewerOlder