Skip to content

Instantly share code, notes, and snippets.

@chikoski
chikoski / fizzbuzz_2.0.rb
Last active December 16, 2015 06:39
Ruby 2.0 のキーワード引数を使った例
def fizzbuzz(from:1, to:100)
(from..to).to_a.map{|i|
msg = "#{i}: "
if(i % 3 == 0)
msg += "Fizz"
end
if(i % 5 == 0)
msg += "Buzz"
end
msg
@chikoski
chikoski / main.rb
Created April 17, 2013 07:27
リンクを全て置き換える Ruby スクリプト
#!/usr/bin/env ruby
require 'logger'
require 'optparse'
require 'substitution'
require 'processor'
substitution = Substitution.new
getopt = OptionParser.new do |opts|
# -*- coding: utf-8 -*-
require 'rspec'
module Factorial
def without_keyword(n)
return 1 if n < 2
return without_keyword(n-1) * n
end
def with_keyword(n: 10)
<!DOCTYPE html>
<html>
<head>
<meta charset=utf-8 />
<title>押すなよ!</title>
</head>
<body>
<button id="pressme">押すなよ!</button>
</body>
</html>
body{
background-color: white;
}
body{
background-color: white;
}
.mouseover{
background-color: rgb(255, 255, 0);
}
social.manifest.facebook: {
"location":"http://desolate-inlet-7521.herokuapp.com/manifest.json",
"name":"WebRTC Social Demo",
"iconURL":"http://desolate-inlet-7521.herokuapp.com/icon.png",
"workerURL":"http://desolate-inlet-7521.herokuapp.com/worker.js",
"sidebarURL":"http://desolate-inlet-7521.herokuapp.com/sidebar.htm",
"origin":"http://desolate-inlet-7521.herokuapp.com",
"enabled":true,"last_modified":135101330568
}
input{
display: inline;
}
<!DOCTYPE html>
<html>
<head>
<meta charset=utf-8 />
<title>アラートを表示するプログラム</title>
</head>
<body>
<form>
<input type="text" id="input_name">
<input type="button" value="OK" id="input_ok">
<form>
お名前をどうぞ: <input type="text" size="20">
<input type="submit" value="OK">
</form>