Skip to content

Instantly share code, notes, and snippets.

@hbsnow
hbsnow / gist:c4f9f751d37280a6471e
Last active August 29, 2015 14:11
インストールされているIEのバージョンを取得する
private int GetIEVersion()
{
var r = new Regex(@"(\d{1,2})\.(\d{1,2})\.[\d]+.[\d]+");
var m = r.Match(Registry.LocalMachine.OpenSubKey(@"Software\Microsoft\Internet Explorer").GetValue("Version").ToString());
var ver1 = Convert.ToInt32(m.Groups[1].Value);
var ver2 = Convert.ToInt32(m.Groups[2].Value);
if (ver1 == 9 && ver2 > 9)
{
@hbsnow
hbsnow / AssignedRolesSeeder.php
Last active August 29, 2015 14:06
Entrust 用のサンプル用 Seeder
<?php
class AssignedRolesSeeder extends Seeder {
/**
* Run the database seeds.
*
* @return void
*/
public function run()
"---------------
" Neobundle
"----------------
set nocompatible
filetype off
if has('vim_starting')
set runtimepath+=~/.vim/bundle/neobundle.vim
call neobundle#rc(expand('~/.vim/bundle/'))
endif
@hbsnow
hbsnow / date.rb
Created August 21, 2013 09:06
Liquid で出力される Jekyll 用の日付のフォーマット用フィルタの plugin
# Liquid filter
# format_date 2013年01月01日
# w3cdtf_date 2013-01-01
module Jekyll
module AssetFilter
def format_date(date)
"#{date.strftime('%Y年%m月%d日')}"
end
@hbsnow
hbsnow / jekyll_ver.rb
Last active December 21, 2015 08:28
jekyll で jekyll と compass のバージョンを取得する plugin
# 使用している jekyll, compass のバージョンを取得する plugin
# {% varsion markup %}
# @markup jekyll, compass
require 'rubygems'
require 'compass'
module Jekyll
class VersionTag < Liquid::Tag
def initialize(tag_name, markup, tokens)
@hbsnow
hbsnow / gist:5624277
Created May 22, 2013 00:00
WordPressでつづきを読むの内容をajaxで取得する
$(".more-link").click(function() {
var $this = $(this);
var $more = $this.parents(".entry-more");
var $content = $more.parents(".entry-content");
var file = $this.attr("href").replace("/#more", "/");
$more.remove();
$content.after("<div class='entry-content-more'><p class='more-loading'><span>now loading...</span></p></div>");
var $more_content = $content.next();
@hbsnow
hbsnow / example.rdf
Created April 8, 2013 05:52
XSLTでabbr要素によってマークアップされた略語に、自動的にtitle属性を別ファイルのXMLを使用して挿入する
<?xml version="1.0" encoding="UTF-8"?>
<rdf:RDF xml:lang="en"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:skos="http://www.w3.org/2004/02/skos/core#">
<skos:Concept rdf:about="http://example.com/glossary/html">
<skos:prefLabel>HyperText Markup Language</skos:prefLabel>
<skos:altLabel>HTML</skos:altLabel>
</skos:Concept>
</rdf:RDF>
@hbsnow
hbsnow / gist:5334487
Created April 8, 2013 05:44
PHPでAからZのアルファベットを連続して出力する
// 小文字
for($i=0; $i<26; $i++){
echo chr(97+$i);
}
// 大文字
for($i=0; $i<26; $i++){
echo chr(65+$i);
}
@hbsnow
hbsnow / fizzbuzz01.js
Created April 7, 2013 17:04
JavaScriptでのFizzBuzz解答例
var data = new Array();
for(var i=1; i<=100; i++){
if(i%3 ===0||i%5 === 0){// 3か5で割り切れるとき
var word = "";
if(i%3 === 0){// 3で割り切れるとき
word += "Fizz";// Fizz追加
}
if(i%5 === 0){// 5で割り切れるとき
word += "Buzz";// Buzz追加
@hbsnow
hbsnow / xor128.js
Last active December 15, 2015 21:29
Xorshift による疑似乱数生成
// xor128 class
var xor128 = {
// member
x: 123456789,
y: 362436069,
z: 521288629,
w: 88675123,
// method
setSeed: function(seed){