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
// pre-push | |
#!/usr/bin/env bash | |
echo "Running pre-push hook" | |
./scripts/run-brakeman.bash | |
./scripts/run-tests.bash | |
# $? stores exit value of the last command | |
if [ $? -ne 0 ]; then | |
echo "Brakeman and Tests must pass before pushing!" |
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
#!/usr/bin/env bash | |
echo "Running pre-commit hook" | |
fileList_rb=$(git diff --diff-filter=d --cached --name-only | grep -E '\.(rb)$') | |
fileList_erb=$(git diff --diff-filter=d --cached --name-only | grep -E '\.(erb)$') | |
if [ ${#fileList_rb} -lt 1 ] && [ ${#fileList_erb} -lt 1 ]; then | |
echo -e "You have no staged .rb or .erb files to test\n" | |
exit |
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
# Example Models | |
class Tournament | |
attribute :name, :string | |
has_many :teams | |
end | |
class Teams | |
attribute :name, :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
is_even = lambda number: number % 2 == 0 | |
is_odd = lambda number: number % 2 != 0 | |
range = range(1, 11) | |
# Generate list using list comprehension | |
even_numbers = [ number for number in range if is_even(number) ] | |
odd_numbers = [ number for number in range if is_odd(number) ] | |
# Output |
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
const students_grades = [ | |
[7.0, 8.0, 6.0], | |
[10.0, 10.0, 10.0], | |
[5.0, 9.0, 10.0] | |
] | |
const reducer = (exams) => { | |
let starter = 0 | |
let number_of_exams = 3 |
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
const user = { | |
name: 'Lucas', | |
lastName: 'Hiago' | |
}; | |
function getUserWithFullName(user) { | |
return { | |
...user, //spead operator | |
fullName: `${user.name} ${user.lastName}` | |
} |
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
#Allows a function accepts n parameters and turns it into a sequence of n functions, each of them take 1 parameter. | |
power_function = -> (x, z) { | |
(x) ** z | |
} | |
base = gets.to_i | |
raise_to_power = power_function.curry.(base) | |
power = gets.to_i |
NewerOlder