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 | |
# Exit immediately if a command exits with a non-zero status | |
set -e | |
# Logging function | |
log() { | |
echo "$(date '+%Y-%m-%d %H:%M:%S') - $1" | tee -a /var/log/setup_script.log | |
} |
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
array = [0,1,2,3,4,5,6,7,8,9] | |
array.each_with_object({:odd => [], :even => []}) do |item, memo| | |
memo[item.odd? ? :odd : :even] << item | |
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
# vim:ft=zsh ts=2 sw=2 sts=2 | |
# | |
# agnoster's Theme - https://gist.github.com/3712874 | |
# A Powerline-inspired theme for ZSH | |
# | |
# # README | |
# | |
# In order for this theme to render correctly, you will need a | |
# [Powerline-patched font](https://gist.github.com/1595572). | |
# |
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 set_items | |
items_params = [] | |
params['barter'].each do |barter| | |
barter['items'].each do |items| | |
items_params << Item.new(amount: items['amount'], kind: items['kind'], survivor_id: barter['survivor_id'] ) | |
end | |
end | |
@items_to_barter_a = items_params.select { |key, value| key.survivor_id == @survivors[0].id } | |
@items_to_barter_b = items_params.select { |key, value| key.survivor_id == @survivors[1].id } | |
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
# -*- mode: ruby -*- | |
# vi: set ft=ruby : | |
# All Vagrant configuration is done below. The "2" in Vagrant.configure | |
# configures the configuration version (we support older styles for | |
# backwards compatibility). Please don't change it unless you know what | |
# you're doing. | |
Vagrant.configure(2) do |config| | |
# The most common configuration options are documented and commented below. | |
# For a complete reference, please see the online documentation at |