Skip to content

Instantly share code, notes, and snippets.

View Kimtaro's full-sized avatar

Kim Ahlström Kimtaro

View GitHub Profile
#!/usr/bin/env ruby
# https://gist.github.com/jvatic/2711625
flag = false
files = `git diff --cached --name-only --diff-filter=ACM | grep "_spec\.rb$"`.split("\n")
files.each do |file|
results = `git diff --cached #{file} | grep "^\+[^+]" | grep ":focus"`.split("\n").map { |r| r.sub(/^\+[\s\t]*/, '') }
if $? == 0
@Kimtaro
Kimtaro / keybase.md
Created February 25, 2014 01:13
keybase.md

Keybase proof

I hereby claim:

  • I am kimtaro on github.
  • I am kimtaro (https://keybase.io/kimtaro) on keybase.
  • I have a public key whose fingerprint is 6A97 1676 C83A 5C3C 0DEB 2C1A 73FF AC4F D496 2F38

To claim this, I am signing this object:

@Kimtaro
Kimtaro / .ruby-version
Last active August 29, 2015 14:04
Wlass
2.1.0
@Kimtaro
Kimtaro / gist:bde33d2ae6f71a5d74d7
Created November 10, 2014 15:29
SPARQL for DBpedia, stations in Tokyo
PREFIX dbo: <http://dbpedia.org/ontology/>
SELECT ?station, ?label, ?lat, ?long, ?location WHERE {
?station rdf:type <http://dbpedia.org/ontology/RailwayStation> .
?station <http://dbpedia.org/ontology/location> :Tokyo .
?station <http://dbpedia.org/ontology/location> ?location .
?station rdfs:label ?label .
?station <http://www.w3.org/2003/01/geo/wgs84_pos#lat> ?lat .
?station <http://www.w3.org/2003/01/geo/wgs84_pos#long> ?long .
FILTER (LANG(?label) = 'ja')
@Kimtaro
Kimtaro / phones.rb
Created February 5, 2009 01:54 — forked from mattt/phones.rb
# 'r' after open-mid central unrounded?
module Keats
module Phones
IPA_CONSONANTS = {
"B" => "b", # b - Lower-case B <be> voiced bilabial plosive
"CH" => "t\312\203", # tʃ - T-Esh ligature <cheese> voiceless postalveolar affricate
"D" => "d", # d - Lower-case D <dee> voiced dental or alveolar plosive
"DH" => "\303\260", # ð - Eth <thee> voiced dental fricative
"F" => "f", # f - Lower-case F <fee> voiceless labiodental fricative
require 'test/unit'
require 'test/unit/ui/console/testrunner'
module Kaku
FULLWIDTH_ROMAJI = '!"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~ '
HALFWIDTH_ROMAJI = '!"#$%&\'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~ '
def fullwidth_to_halfwidth(text)
text.gsub(/\xEF[\xBC\xBD]./) do |m|
m[1] == 188 ?
#!/usr/bin/env ruby
# TextMate command for very simple pretty-printing of SQL
print $stdin.readlines.join("\n").gsub(/
(
SELECT (\s+ DISTINCT)? |
FROM |
(LEFT (\s+ OUTER)? | INNER)? \s* JOIN |
UNION |
WHERE |
# Run like so: perl api_functional.pl api.smart.fm YOUR_API_KEY
use strict;
use warnings;
use utf8;
use Test::More qw(no_plan);
use LWP::UserAgent;
use JSON;
use XML::Simple;
use Data::Dumper;
# -*- encoding: utf-8 -*-
require 'benchmark'
require 'rubygems'
require 'active_support'
require 'oniguruma'
include Oniguruma
SKIP_INVALID_UTF8 = Iconv.new('UTF-8//IGNORE', 'UTF-8')
SIZE_R = ORegexp.new('.', '', 'utf8')
use strict;
use warnings;
use utf8;
use LWP::UserAgent;
use JSON;
use XML::Simple;
use Data::Dumper;
use Time::HiRes qw(gettimeofday tv_interval);
use URI::Escape qw(uri_escape_utf8);