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/bash | |
# bash で yes/no を聞く。 | |
# | |
# See http://yuki.silk.to/2006/04/000161.html | |
# http://usaturn.net/memo/shell_tech_yesorno.html | |
function yes_no() { | |
echo "-------------------------------------------" | |
echo "よろしいですか?(yes/no)" |
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 lang="ja"> | |
<head> | |
<meta charset="utf-8"> | |
<title>Canvas でお絵描き</title> | |
<style> | |
#mycanvas { | |
border: 3px solid #999; | |
cursor: crosshair; | |
} |
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
# coding: utf-8 | |
# See http://docs.ruby-lang.org/ja/2.0.0/library/drb.html | |
require 'pp' | |
require 'drb/drb' | |
# 接続先の URI | |
SERVER_URI="druby://localhost:8787" | |
# DRbサーバを起動する |
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 | |
# See http://web-salad.hateblo.jp/entry/2014/04/06/164312 | |
# このコードを元に、少し変更して、全解を得るようにした。 | |
# 文字に日本語もあつかえるようにした。 | |
# | |
# 覆面算の例: http://ja.wikipedia.org/wiki/%E8%A6%86%E9%9D%A2%E7%AE%97 | |
# | |
DOCUMENT = <<EOS | |
Find solutions to alphametic equations. |
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/xcrun swift | |
// See https://gist.github.com/kristopherjohnson/eb7dc5b6af06eb42ef38 | |
// http://codereview.stackexchange.com/questions/56872/fraction-rational-number-structure-with-custom-operators | |
import Cocoa | |
public struct Rational { | |
let numer: Int | |
let denom: Int |
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
# coding: utf-8 | |
# See http://ja.stackoverflow.com/questions/4739 | |
# https://gist.github.com/snipsnipsnip/0e267f6a39cc2397da3d | |
# | |
# 2 分木をコンソールにアスキーアートで出力する。 | |
# | |
require 'gviz' # gem install gviz |
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
# See http://keibakuroku.jp/category/brain-teaser | |
def pi_1(len) | |
count = 0 | |
k, a, b, a1, b1 = 2, 4, 1, 12, 4 | |
while TRUE | |
# Next approximation | |
p, q, k = k*k, 2*k+1, k+1 | |
a, b, a1, b1 = a1, b1, p * a + q * a1, p * b + q * b1 |
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
# coding: utf-8 | |
File.open(ARGV[0], "r:utf-8" ) do |f| | |
while line = f.gets | |
line2 = '' | |
line.chars do |c| | |
line2 += c | |
code = c.ord | |
line2 += ' ' unless 0 <= code && code <= 255 | |
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
# ------ 実行例 | |
$ ruby rest.rb | |
id:064c0150-db48-11e4-835e-12f5ba1407e2, name:"ローン申請の 審査" | |
id:073f66b2-db36-11e4-bc81-12f5ba1407e2, name:"Assign Approver" | |
id:077a4cf8-db36-11e4-bc81-12f5ba1407e2, name:"Review Invoice" | |
id:0bd16b17-db39-11e4-b167-12f5ba1407e2, name:"Assign Approver" | |
id:0bf6a67d-db39-11e4-b167-12f5ba1407e2, name:"Review Invoice" | |
id:247d07d5-db14-11e4-9656-12f5ba1407e2, name:"Prepare Bank Transfer" | |
id:304be6fb-db4e-11e4-b444-12f5ba1407e2, name:"Assign Approver" | |
id:3079fbeb-db4e-11e4-b444-12f5ba1407e2, name:"Approve Invoice" |
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
{ | |
"total":5, | |
"records":5, | |
"page":1, | |
"rows":[{ | |
"id":"1", | |
"cell":[ | |
"a", | |
"AAA", | |
0,"",false,true,true |
OlderNewer