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
class Player | |
def initialize | |
@max_health = 20 | |
@last_health = @max_health | |
@taking_damage = false | |
@directions = [:backward, :forward] | |
@current_direction = :forward | |
@reached_wall = false | |
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
# app/models/event.rb | |
class Event < ActiveRecord::Base | |
field :name, :type => String # "Maailmanlopun reivit" | |
field :date, :type => Date # "2012-12-21" | |
field :description, :type => String # "Osallistumalla nakkiin pääset maksutta bileisiin..." | |
has_many :tasks | |
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
echo "Updates packages. Asks for your password." | |
sudo apt-get update -y | |
echo "Installs packages. Give your password when asked." | |
sudo apt-get install build-essential bison openssl libreadline6 libreadline6-dev curl git-core zlib1g zlib1g-dev libssl-dev libyaml-dev libsqlite3-0 libsqlite3-dev sqlite3 libxml2-dev libxslt-dev autoconf libc6-dev -y | |
echo "Installs ImageMagick for image processing" | |
sudo apt-get install imagemagick --fix-missing -y | |
echo "Installs RVM (Ruby Version Manager) for handling Ruby installation" |
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
industry_codes = Hash.new | |
(1..150).each do |industry_code| | |
query = "http://api.linkedin.com/v1/company-search:(companies:(industry))?facet=industry,"+industry_code.to_s+"&count=1&format=json" | |
linkedin_response = JSON.parse(previously_acquired_access_token.get(query).body) | |
industry_codes[industry_code] = linkedin_response.try(:[], "companies").try(:[], "values").try(:[], 0).try(:[], "industry") | |
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
require 'httparty' | |
auth = { :username => "oma_nick", :password => "oma_salasana" } | |
#groups = HTTParty.get("https://convore.com/api/groups.json", :basic_auth => auth) | |
#puts YAML::dump(groups) | |
#=> tässä tapauksessa haluttu id on 2648 | |
topics = HTTParty.get("https://convore.com/api/groups/2648/topics.json", :basic_auth => auth) | |
all_topics = topics["topics"] |