This file contains hidden or 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 | |
class Fixnum | |
def fizzbuzz | |
return self if !fizz? && !buzz | |
[fizz, buzz].compact.join | |
end | |
private |
This file contains hidden or 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
require 'minitest/autorun' | |
def split_price(price_text) | |
price_text.to_s.match(/([^万円]*)(.*)/)[1..2] | |
end | |
describe 'split_price' do | |
let(:manyen) { '110.0万円'} | |
let(:yen) { '2015円'} | |
let(:comma) { '1,123,456円'} |
This file contains hidden or 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
class Array | |
def sorted? | |
return true if self.size < 2 | |
1.upto(self.size - 1) do |i| | |
return false unless self[i - 1] <= self[i] | |
end | |
true | |
end | |
end |
This file contains hidden or 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 | |
puts <<EOS | |
The MIT License (MIT) | |
Copyright (c) #{Time.now.year} #{`git config user.name`.chomp} | |
Permission is hereby granted, free of charge, to any person obtaining a copy | |
of this software and associated documentation files (the "Software"), to deal | |
in the Software without restriction, including without limitation the rights |
This file contains hidden or 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> | |
<title>marquee test</title> | |
</head> | |
<body> | |
<marquee>デフォルト</marquee> | |
<marquee width="90%">幅90%</marquee> | |
<marquee behavior="scroll">横切る(デフォルト)</marquee> | |
<marquee behavior="alternate">往復する</marquee> |
This file contains hidden or 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
# subscribe in feedly | |
http://cloud.feedly.com/#subscription/feed/%s |
This file contains hidden or 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
require 'prime' | |
def prime600(n) | |
(n..n+599).each do |i| | |
if Prime.prime? i | |
p i | |
end | |
end | |
end |
This file contains hidden or 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
<input type="radio" name="disableme" id=1> Animal | |
<input type="radio" name="disableme" id=2> Mammal | |
<input type="radio" name="disableme" id=3> Human | |
var radios = document.formName.disableme; | |
for (var i=0, iLen=radios.length; i<iLen; i++) { | |
radios[i].disabled = true; | |
} |
This file contains hidden or 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
# Common DOCTYPE Declarations | |
## HTML 5 | |
``` | |
<!DOCTYPE html> | |
``` | |
## HTML 4.01 Strict |
This file contains hidden or 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
using System.Runtime.InteropServices; | |
public class xxxController | |
{ | |
private const string XXX = "xxx"; | |
[DllImport("KERNEL32.DLL")] | |
public static extern uint | |
GetPrivateProfileString(string lpAppName, | |
string lpKeyName, string lpDefault, |