Skip to content

Instantly share code, notes, and snippets.

View 284km's full-sized avatar

Kazuma Furuhashi 284km

View GitHub Profile
@284km
284km / gist:8912899
Created February 10, 2014 09:30
c# での ini ファイル読み込み
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,
@284km
284km / gist:9028864
Created February 16, 2014 03:34
Common DOCTYPE Declarations
# Common DOCTYPE Declarations
## HTML 5
```
<!DOCTYPE html>
```
## HTML 4.01 Strict
@284km
284km / gist:9030825
Created February 16, 2014 07:48
radio button を非活性にする
<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;
}
require 'prime'
def prime600(n)
(n..n+599).each do |i|
if Prime.prime? i
p i
end
end
end
@284km
284km / gist:9594457
Created March 17, 2014 05:33
subscribe in feedly
# subscribe in feedly
http://cloud.feedly.com/#subscription/feed/%s
<!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>
#!/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
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
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円'}
#!/usr/bin/env ruby
class Fixnum
def fizzbuzz
return self if !fizz? && !buzz
[fizz, buzz].compact.join
end
private