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
require 'rss' | |
require 'open-uri' | |
url = 'http://www.ruby-lang.org/en/feeds/news.rss' | |
open(url) do |rss| | |
feed = RSS::Parser.parse(rss) | |
puts "Title: #{feed.channel.title}" | |
feed.items.each do |item| | |
puts "Item: #{item.title}" | |
end |
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
class Parameter | |
attr_accessor :value | |
def initialize(value, update) | |
@value = value | |
@update = update | |
end | |
def update | |
@value = @update.call | |
end |
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
class Parameter | |
property value | |
def initialize(value, update) | |
@value = value | |
@update = update | |
end | |
def update | |
@value = @update.call | |
end | |
end |
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
import com.badlogic.gdx.Gdx; | |
import com.badlogic.gdx.graphics.Texture; | |
import com.badlogic.gdx.graphics.g2d.TextureRegion; | |
import com.badlogic.gdx.utils.XmlReader; | |
import com.badlogic.gdx.utils.XmlReader.Element; | |
import java.util.HashMap; | |
/** | |
* Created by adam on 2/7/2016. |
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
require 'httparty' | |
require 'nokogiri' | |
def get_id url | |
#extract the id from the url | |
url.scan(/id(\d+)/).first.first | |
end | |
def get_page url | |
#download the html content of the podcast page using itunes user-agent |
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
int COLS = 6; | |
int ROWS = 6; | |
Tile[][] grid; | |
float wind = 0; | |
PGraphics pick_buffer; | |
class Tile { | |
float age, mass, water, food; | |
Tile() { | |
age = 0; |
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
require 'httparty' | |
key = @apikey | |
target = 'http://feeds.reuters.com/news/usmarkets?format=html' | |
url = "http://gateway-a.watsonplatform.net/calls/url/URLGetTextSentiment?apikey=#{key}&url=#{target}&outputMode=json" | |
response = HTTParty.post(url, headers: {'Content-Type' => 'application/x-www-form-urlencoded'}) | |
puts response.body |
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
#pragma once | |
#include <vector> | |
#include <list> | |
#include <queue> | |
#include <memory> | |
#include <sstream> | |
class Graph { | |
std::vector<std::list<int>> adj; |
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
<!DOCTYPE html><html><head></head><body></body></html> |
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
#include <chrono> | |
#include <functional> | |
template<class T> | |
long long benchmark(std::function<void()> op) { | |
auto start = std::chrono::steady_clock::now(); | |
op(); | |
return std::chrono::duration_cast<T>(std::chrono::steady_clock::now() - start).count(); | |
} |
OlderNewer