Skip to content

Instantly share code, notes, and snippets.

View iwamot's full-sized avatar

Takashi Iwamoto iwamot

View GitHub Profile
javascript:(function(){if(a=document.getElementById('ASIN'))location.href='http://colorchart.jp/color/'+a.value;})();
// ==UserScript==
// @name cookpad_tukurepo(iwamot)
// @namespace http://github.com/iwamot
// @include http://cookpad.com/*
// origin http://d.hatena.ne.jp/samurai20000/20090715/1247668133
// ==/UserScript==
(function(){
function get_tukurepo(elem) {
if (!elem) {
{
"hproduct": {
"fn": "RESTful Webサービス",
"bland": "オライリー・ジャパン",
"category": "Book",
"price": "¥ 3,990",
"photo": [
{
"src": "http://ecx.images-amazon.com/images/I/51ojIhXBP3L._SL75_.jpg",
"height": "75",
{
"link": [
{
"rel": "self",
"href": "http://keeplist.in/amazonsearch?q=Web%E3%82%92%E6%94%AF%E3%81%88%E3%82%8B%E6%8A%80%E8%A1%93&format=json&page=2",
"type": "application/json"
},
{
"rel": "alternate",
"href": "http://keeplist.in/amazonsearch?q=Web%E3%82%92%E6%94%AF%E3%81%88%E3%82%8B%E6%8A%80%E8%A1%93&format=html&page=2",
--- ext/standard/html.c.org 2007-12-31 16:22:52.000000000 +0900
+++ ext/standard/html.c 2012-03-07 23:33:19.000000000 +0900
@@ -439,19 +439,29 @@
} \
mbseq[mbpos++] = (mbchar); }
+#define CHECK_LEN(pos, chars_need) \
+ if((str_len - (pos)) < chars_need) { \
+ *newpos = pos; \
+ return 0; \
@iwamot
iwamot / gist:2973895
Created June 22, 2012 16:38
Sudoku solver
def cross(cols, rows)
cols.split('').product(rows.split('')).map{|c, r| c + r}
end
$digits = '123456789'
$rows = 'ABCDEFGHI'
$cols = $digits
$squares = cross($rows, $cols)
$unitlist = $cols.split('').map{|c| cross($rows, c)} +
$rows.split('').map{|r| cross(r, $cols)} +