This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!ruby | |
require 'serialport' | |
@port = SerialPort.new( | |
"/dev/tty.usbserial-A402PY11", | |
38400, | |
8, | |
1, | |
0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function createElementFromString (str, opts) { | |
if (!opts) opts = { data: {} }; | |
if (!opts.data) opts.data = { }; | |
var t, cur = opts.parent || document.createDocumentFragment(), root, stack = [cur]; | |
while (str.length) { | |
if (str.indexOf("<") == 0) { | |
if ((t = str.match(/^\s*<(\/?[^\s>\/]+)([^>]+?)?(\/)?>/))) { | |
var tag = t[1], attrs = t[2], isempty = !!t[3]; | |
if (tag.indexOf("/") == -1) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function log (m) { | |
var o = Array.prototype.concat.apply([], arguments); | |
location.href = "javascript:(function () { if (window.console) console.log.apply(console.log, "+o.toSource()+") })();"; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// from http://www.joehewitt.com/blog/files/getElementsBySelector.js | |
// modified | |
function convertSelectorToXPath (rule, start) { | |
var regElement = /^([#.]?)([a-z0-9\\*_-]*)((\|)([a-z0-9\\*_-]*))?/i; | |
var regAttr1 = /^\[([^\]]*)\]/i; | |
var regAttr2 = /^\[\s*([^~=\s]+)\s*(~?=)\s*"([^"]+)"\s*\]/i; | |
var regPseudo = /^:([a-z_-])+/i; | |
var regCombinator = /^(\s*[>+\s])?/i; | |
var regComma = /^\s*,/i; | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
気 私 | ________ | |
持 |. ,. - ´ ` - 、 | |
ち .あ | ,.ノ ヽ | |
悪 あ | ∠,イ / i{ ハ! i ! l }. 、 | |
い い | /イ { -从{ i} ! ハ}┼!┐ :ハ | |
ん う | {ⅩレT:カVリN T:カ}!: :Ⅹ: : :.'; | |
で の | ∠: : ! ゞ ' ゞイ!: : : : : :.N | |
す | レi入" r--、 "'レ!: : ;、/レ' | |
よ |. // >- ,. -< `'´ | |
ね. | { { ,イ^{、 __ ,..イ:::>、 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var DTMF = function () { this.init.apply(this, arguments) }; | |
DTMF.prototype = { | |
table : { | |
"1" : [697, 1209], "2" : [697, 1336], "3" : [697, 1477], "A" : [697, 1633], | |
"4" : [770, 1209], "5" : [770, 1336], "6" : [770, 1477], "B" : [770, 1633], | |
"7" : [852, 1209], "8" : [852, 1336], "9" : [852, 1477], "C" : [852, 1633], | |
"*" : [941, 1209], "0" : [941, 1336], "#" : [941, 1477], "D" : [941, 1633] | |
}, | |
init : function (context, opts) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
nnoremap epp a<C-R>=join(split(substitute(expand("%:p"), '.*lib/\\|.pm$', "", "g"), "/"), "::")<CR> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sub unindent ($) { | |
my ($str) = @_; | |
$str =~ /^\n*(\s+)/; | |
if ($1) { | |
my $indent = $1; | |
$str =~ s/$indent//g; | |
} | |
$str; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var url = "http://cho45.g.hatena.ne.jp/cho45/"; | |
var s = {}; | |
next(function getRkm () { | |
return xhttp.get(url). | |
next(function (r) { | |
s.rkm = r.responseText.replace(/^[\S\s]*Hatena\.rkm\s*=\s*(?:'([^']+)'|"([^"]+)")[\S\s]*$/, function (_, v1, v2) { | |
return v1 || v2; | |
}); | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Multi login for Hatena | |
* cho45 <cho45@lowreal.net> | |
* 2007-10-15 | |
* | |
* License: | |
* Creative Commons by | |
* http://creativecommons.org/licenses/by/3.0/ | |
* | |
* Using information in your password manager, |