- Where to Add Snippets
- How to find out the language selector (scope)
- How to format a snippit
In Atom, you can add snippets by going to the Atom menu and going to Snippets...
def addition_function # declare this outside of the case and loop so we can call it repeatedly | |
puts "Which numbers would you like to add?" | |
n1 = gets.chomp.to_i | |
n2 = gets.chomp.to_i | |
answer = n1 + n2 | |
puts "The sum is: #{answer}" | |
end | |
def show_menu | |
puts "Calculator" |
class Integer | |
def luhn_sum | |
num = self.to_s.chars | |
sum = 0 | |
num.reverse.each_with_index do |n,i| | |
n = n.to_i | |
n *= 2 if i % 2 == 1 |
#!/bin/sh | |
BRANCH=$(git branch | grep \* | cut -d ' ' -f2) | |
REF=$(git merge-base master $BRANCH) | |
DIFFS=$(git diff --diff-filter AM --name-only --relative $REF) | |
if [ "$DIFFS" != "" ] | |
then | |
echo "Checking for rubocop offenses..." | |
OFFENSES=$(rubocop $(echo "$DIFFS")) | |
if [ "$(echo $OFFENSES | grep 'no offenses')" == "" ] | |
then |