Skip to content

Instantly share code, notes, and snippets.

View kuboon's full-sized avatar
🏠
Working from home

Ohkubo KOHEI kuboon

🏠
Working from home
View GitHub Profile
@kuboon
kuboon / gist:50495
Created January 22, 2009 10:39
GetProxyForUrl.cpp
/**
@file 現在のOSのProxy設定を読み取る
*/
#include "StdAfx.h"
#include <Winhttp.h>
#pragma comment(lib, "Winhttp.lib")
#include <shlwapi.h>
#pragma comment(lib, "shlwapi.lib")
@kuboon
kuboon / jforty.html
Created June 15, 2012 06:53
Forth for control jQuery
<html>
<head>
<title>jQuery forth test</title>
<link rel="stylesheet" href="http://code.jquery.com/ui/1.8.21/themes/base/jquery-ui.css" type="text/css" media="all" />
<link rel="stylesheet" href="http://static.jquery.com/ui/css/demo-docs-theme/ui.theme.css" type="text/css" media="all" />
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js" type="text/javascript"></script>
<script src="http://code.jquery.com/ui/1.8.21/jquery-ui.min.js" type="text/javascript"></script>
<script src="http://jquery-ui.googlecode.com/svn/tags/latest/ui/minified/i18n/jquery-ui-i18n.min.js" type="text/javascript"></script>
</head>
<body>
@kuboon
kuboon / application_helper.rb
Created July 26, 2012 08:15
glyph icon helper for twitter-bootstrap with Rails
module ApplicationHelper
# ==== Examples
# glyph(:share_alt)
# # => <i class="icon-share-alt"></i>
# glyph(:lock, :white)
# # => <i class="icon-lock icon-white"></i>
def glyph(*names)
content_tag :i, nil, class: names.map{|name| "icon-#{name.to_s.gsub('_','-')}" }
end
@kuboon
kuboon / send_file_with_utf8.rb
Last active December 16, 2015 20:39
allow you to send_file with multibyte filename
wget https://gist.github.com/kuboon/5494463/raw/31d80be6dc23eac2bc05d996df1e0293ae001124/send_file_with_utf8.rb -P config/initializers/
@kuboon
kuboon / solr.cap
Created September 9, 2014 05:12
put in lib/capistrano/tasks
namespace :solr do
def args
fetch(:sunspot_args, "")
end
def sunspot_roles
fetch(:sunspot_server_role, :app)
end
desc "start solr"
@kuboon
kuboon / gist:e5c779833e7b8dc405ed
Last active August 29, 2015 14:09
人狼アリーナ API

POST /villages

村を建てます。

村の名前と説明を指定します。村の説明は、他のプレイヤーの参加を待つ間何度でも変更可能ですが、村の名前は後からは変更できません。

また、この村でのあなたの名前も指定してください。これも後からは変更できません。

Example

module ApplicationHelper
def omit(val = nil, &block)
unless block_given?
raise 'no parent block' if @_omit.empty?
@_omit[-1] = false unless val.nil?
return val
end
raise "Don't pass a value with block" if val
@_omit ||= []
@kuboon
kuboon / generator.rb
Last active August 29, 2015 14:14
Ruby/Rails supported versions matrix
# gem install octokit
require 'octokit'
require 'yaml'
TARGET = 'rails/rails'
def main
md_table 'rails', tags.lazy.map(&method(:pair)).take_while{|k,v| v}.to_h
end
def md_table(name, hash)
@kuboon
kuboon / edge_back.html
Last active September 10, 2015 01:44
Avoid the behavior that Edge browser does not persist checkbox and radio state on history.back()
<input type="hidden" id="edge_back_data_store" />
<script type="text/javascript">
+function(){
var edge_ver = function(){
var match = navigator.userAgent.match(new RegExp('Edge/(.+)'));
return match ? parseFloat(match[1]) : 999
}
if(12.1024 < edge_ver()) return;
var data_store = document.getElementById('edge_back_data_store');