Skip to content

Instantly share code, notes, and snippets.

@harmaty
harmaty / gritter.erb
Created September 29, 2011 14:15
Usage of gritter
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Nothing</title>
</head>
<body>
<%= content_for :gritter do %>
<%= js add_gritter("This is a notice", :image => :success,
@harmaty
harmaty / csv2github.rb
Created January 16, 2013 17:30
This script imports issues from Planbox csv file to Github.
require "net/http"
require "uri"
require "json"
require "csv"
class TicketsImport
def initialize(options)
@uri = URI.parse("https://api.github.com/repos/#{options[:user]}/#{options[:repo]}/issues")
@http = Net::HTTP.new(@uri.host, @uri.port)
@http.use_ssl = true
=begin
Given
1. An array of strings where "L" indicates land and "W" indicates water,
2. a coordinate marking a starting point in the middle of the ocean
The Challenge:
Find and mark the ocean in the map by changing appropriate W's to O's.
An ocean coordinate is defined to be any coordinate directly adjacent to any other ocean coordinate.
=begin
Given
1. An array of strings where "L" indicates land and "W" indicates water,
2. a coordinate marking a starting point in the middle of the ocean
The Challenge:
Find and mark the ocean in the map by changing appropriate W's to O's.
An ocean coordinate is defined to be any coordinate directly adjacent to any other ocean coordinate.
require 'set'
class Point
attr_accessor :name, :x, :y
class << self
def parse(str)
name, x, y = str.split(',')
new(name, x.to_i, y.to_i)
end