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
#! /bin/sh | |
exec ruby -S -x "$0" "$@" | |
#! ruby | |
# 迷路のマス | |
class Cell | |
def initialize(value) | |
@value = value | |
# どのマスからくるか | |
@prev_value = case value |
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
raw_list = [] | |
while str = STDIN.gets.chomp | |
break if str.empty? | |
raw_list.push str.to_i | |
end | |
class GetterPrimer | |
def initialize | |
@primes = [2] | |
@max_checked = 2 |
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 <stdio.h> | |
#include <stdlib.h> | |
#include <string.h> | |
#define FALSE 0 | |
#define TRUE 1 | |
int isPrime(int num) { | |
if (num == 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
def get_patterns(number, operators) | |
numbers = number.split '' | |
size = numbers.size | |
p operators | |
.repeated_permutation(size - 1) | |
.map { |operators_combination| | |
numbers.map.with_index {|num, index| "#{num}#{operators_combination[index]}"} | |
} | |
.map { |item| eval item.join('').gsub(/^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
def cut8column(num) | |
if num.to_s.size > 8 | |
num.to_s.slice(-8, 8).to_i | |
else | |
num | |
end | |
end | |
def get_pow(b, exponent) | |
if b == 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
<!doctype html> | |
<html> | |
<head> | |
<meta charset="UTF-8"> | |
<title>mithriltest</title> | |
<script src="//cdnjs.cloudflare.com/ajax/libs/mithril/0.2.0/mithril.min.js"></script> | |
<script> | |
// Namespace | |
var todo = {}; |
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
# encoding: UTF-8 | |
Earthquake.once do | |
module TwitterOAuth | |
class Client | |
def favorites_list(user, **options) | |
options = URI.encode_www_form(options) | |
get("/favorites/list.json?screen_name=#{user}&#{options}") | |
end | |
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
# Description: | |
# Let's study with O'Reilly books | |
# | |
# Dependencies: | |
# "cheerio-httpcli": "^0.3.3" | |
# | |
# Commands: | |
# hubot 勉強したい - get a オライリー book | |
cheerio = require 'cheerio-httpcli' |
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
#!/usr/bin/env ruby | |
require "net/http" | |
require "uri" | |
require "nokogiri" | |
params = { keyword: ARGV.join("\s") } | |
uri = URI.parse("http://commit-m.minamijoyo.com/commits/search") | |
uri.query = URI.encode_www_form(params) |
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
oo = %w(O o) | |
time = ARGV[0].to_i | |
puts time.times.map{oo.sample 1}.flatten.join |