Skip to content

Instantly share code, notes, and snippets.

View pocari's full-sized avatar
🍻
🍻

pocari pocari

🍻
🍻
View GitHub Profile
@pocari
pocari / gist:3071046
Created July 8, 2012 14:06
android pattern auth
#android pattern auth
#0 1 2
#3 4 5
#6 7 8
$constraints = [
{2 => 1, 8 => 4, 6 => 3}, #0
{7 => 4}, #1
{0 => 1, 6 => 4, 8 => 5}, #2
class Object
def eigenclass
class << self
self
end
end
end
module Util
module_function
@pocari
pocari / layout_mapper.rb
Created September 29, 2012 10:36
FixedLayoutMapper
#coding: Windows-31J
module FixedLayoutMapper
class Mapper
class ColumnMapper
attr_accessor :layout_mapper, :converter
def initialize(layout_mapper, converter = nil)
@layout_mapper = layout_mapper
@converter = converter
end
@pocari
pocari / download_with_basic_auth.js
Created November 8, 2012 13:55
basic認証のサイトからファイルをダウンロードするサンプル
var BASIC_AUTH_USER = "tomcat";
var BASIC_AUTH_PASS = "tomcat";
var URL_PREFIX = "http://localhost:8080";
//------------------------------------------------------------
var HTTPREQUEST_SETCREDENTIALS_FOR_SERVER = 0;
var adTypeBinary = 1;
var adSaveCreateOverWrite = 2;
@pocari
pocari / js_html_parse.js
Created November 10, 2012 06:46
html parse sample
var fso = new ActiveXObject("Scripting.FileSystemObject");
function with_openfile(path, action) {
var f = null;
try {
f = fso.openTextFile(path);
return action(f);
} finally {
if (f) {
f.close();
@pocari
pocari / to_graph.rb
Created November 10, 2012 14:06
時系列可視化
#coding: Windows-31J
require 'win32ole'
require 'date'
$ROUND_MIN = 15
module ExcelConstants
end
@pocari
pocari / gen_time.rb
Created November 11, 2012 04:55
4051188 用のテストデータ
#https://gist.github.com/4051188 用のテストデータ
require 'date'
def by_min
Rational(1, 1440) #24 * 60
end
def gen_range
ret = []
@pocari
pocari / GraphVizTest.rb
Created December 4, 2012 16:20
GraphVizTest
require "graphviz"
#http://www.graphviz.org/Download_windows.php
g = GraphViz::new("G", { :type => "digraph", :use => "dot"})
depends = {
1 => [],
2 => [1],
3 => [1],
require 'socket'
class SMTPParameters
attr_accessor :helo_name, :from, :rcpt, :data
def initialize
@helo_name = nil
@from = nil
@rcpt = []
@data = nil
end
@pocari
pocari / pattern.rb
Last active December 19, 2015 17:09
#encoding: Windows-31J
# 3行5列のマスを塗っていくパターンは
# ある列がそれより左の列の1行目が塗られている場合のみ塗れるので、
# ・1列目だけ塗るパターン
# ■
# □
# □
#
# ・2列めまで塗るパターン
# ■■