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
company_names = ["Tekfly", "Yabox", "Vinder", "Skiptube", "Fivespan"] | |
company_names.each_with_index do |company_name, index| | |
puts "#{company_name} has index #{index}" | |
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
Tekfly has index 0 | |
Yabox has index 1 | |
Vinder has index 2 | |
Skiptube has index 3 | |
Fivespan has index 4 |
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
company_names = ["Tekfly", "Yabox", "Vinder", "Skiptube", "Fivespan"] |
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
[8] pry(main)> is_enumerable?("I'm a string") | |
=> false | |
[9] pry(main)> is_enumerable?(["array", "of", "things"]) | |
=> true |
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
def is_enumerable?(object) | |
object.is_a? Enumerable | |
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
#!/bin/bash | |
touch /tmp/Recent.xyz | |
while true | |
do | |
echo "Checking again..." | |
wget -q https://apt.dockerproject.org/repo/dists/ubuntu-xenial/main/binary-amd64/InRelease -O /tmp/InRelease.xyz | |
if test /tmp/InRelease.xyz -nt Recent.xyz; then | |
mplayer /usr/share/sounds/ubuntu/stereo/phone-incoming-call.ogg |
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
--- | |
# Patches openssl problem and restarts needed services | |
- name: Apply common configration to all nodes | |
hosts: all | |
sudo: yes | |
# Uncomment to apply update one server at a time | |
# serial: 1 | |
tasks: | |
- name: "Install packages and update cache" |
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
#!/bin/sh | |
# | |
# Patches and installs Ruby to expose OpenSSL context options, using rbenv. | |
# | |
# Based on http://philippe.bourgau.net/how-to-install-a-patched-ruby-interpreter-wit/ | |
# | |
VERSION=2.1.6 | |
PATCH_URL="https://bugs.ruby-lang.org/attachments/download/4210/0001-Expose-the-SSLContext-options-attribute-in-Net-HTTP.patch" | |
PATCH_NAME=ssloptions |
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
# Capistrano 2 | |
before "deploy", "friday:good_luck" | |
namespace :friday do | |
friday_jumper = %{ | |
┓┏┓┏┓┃ | |
┛┗┛┗┛┃⟍ ○⟋ | |
┓┏┓┏┓┃ ∕ Friday | |
┛┗┛┗┛┃ノ) |
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
# References | |
# http://en.wikipedia.org/wiki/Bank_card_number | |
# http://en.wikipedia.org/wiki/Luhn_algorithm | |
def valid_credit_card?(number) | |
number = number.to_s.gsub(/\D/, "") | |
return false unless valid_association?(number) | |
number.reverse! |