Skip to content

Instantly share code, notes, and snippets.

View vmi's full-sized avatar
😣
I may be slow to respond.

Motonori IWAMURO vmi

😣
I may be slow to respond.
View GitHub Profile
@vmi
vmi / gist:1984503
Created March 6, 2012 07:07
show hatena bookmark
javascript:(function(){function u(e){return document.evaluate(e,document.head,null,2,null).stringValue}open("http://b.hatena.ne.jp/entry?mode=more&url="+encodeURIComponent(u("link[@rel='canonical']/@href")||u("//meta[@property='og:url']/@content")||location.href),"_blank")})()
@vmi
vmi / gist:1720443
Created February 2, 2012 00:38
3 digit comma grouping regex
s/\B(?=(?:\d{3})+$)/,/g
@vmi
vmi / ivysettings.xml
Created January 28, 2012 08:22
Share maven2 cache for ivy
<?xml version="1.0" encoding="UTF-8"?>
<ivysettings>
<include url="${ivy.default.settings.dir}/ivysettings-public.xml" />
<settings defaultResolver="default" />
<property name="m2.dir" value="${user.home}/.m2/repository" />
<property name="m2.pattern" value="[organisation]/[module]/[revision]/[module]-[revision](-[classifier]).[ext]" />
<resolvers>
<filesystem name="local" m2compatible="true">
<artifact pattern="${m2.dir}/${m2.pattern}" />
<ivy pattern="${m2.dir}/${m2.pattern}" />
@vmi
vmi / repeater.js
Created January 19, 2012 06:54
Repeat function with named item
/*
* Fair License (Fair)
*
* Copyright (c) 2012, IWAMURO Motonori
*
* Usage of the works is permitted provided that this instrument is
* retained with the works, so that any entity that uses the works is
* notified of this instrument.
*
* DISCLAIMER: THE WORKS ARE WITHOUT WARRANTY.
@vmi
vmi / string-format.js
Created January 19, 2012 01:40
simple string format utilities
/*
* Fair License (Fair)
*
* Copyright (c) 2012, IWAMURO Motonori
*
* Usage of the works is permitted provided that this instrument is
* retained with the works, so that any entity that uses the works is
* notified of this instrument.
*
* DISCLAIMER: THE WORKS ARE WITHOUT WARRANTY.
@vmi
vmi / utf8length.js
Created January 18, 2012 14:29
Calulate byte length of string as UTF-8.
/*
* Fair License (Fair)
*
* Copyright (c) 2012, IWAMURO Motonori
*
* Usage of the works is permitted provided that this instrument is
* retained with the works, so that any entity that uses the works is
* notified of this instrument.
*
* DISCLAIMER: THE WORKS ARE WITHOUT WARRANTY.
@vmi
vmi / gist:1619636
Created January 16, 2012 07:37
Get google closure compiler
#!/bin/bash
if [ -f compiler-latest.zip ]; then
read -p 'Re-get archive?(y/N) ' yn
case "$yn" in
y|Y|yes)
;;
*)
echo "Abort."
exit 1
@vmi
vmi / xpash.rb
Created January 6, 2012 10:08
xpash - Interactive XPath Shell
#!/usr/bin/ruby
# -*- coding: utf-8 -*-
#
# xpash - Interactive XPath Shell
require 'readline'
require 'rexml/document'
include REXML
@vmi
vmi / gist:1470977
Created December 13, 2011 06:56
[snippet] WIN32OLE Excel (ruby)
#!/usr/bin/ruby
# -*- coding: utf-8 -*-
require 'win32ole'
WIN32OLE.codepage = WIN32OLE::CP_UTF8
$fso = WIN32OLE.new('Scripting.FileSystemObject')
$xl = WIN32OLE.new('Excel.Application')
@vmi
vmi / gist:1470974
Created December 13, 2011 06:55
[snippet] WIN32OLE Word (ruby)
#!/usr/bin/ruby
# -*- coding: utf-8 -*-
require 'win32ole'
WIN32OLE.codepage = WIN32OLE::CP_UTF8
$fso = WIN32OLE.new('Scripting.FileSystemObject')
$wd = WIN32OLE.new('Word.Application')