Skip to content

Instantly share code, notes, and snippets.

View zerobase's full-sized avatar

Hideto Ishibashi zerobase

View GitHub Profile
@zerobase
zerobase / safari-reading-list-to-instapaper-csv.rb
Last active July 16, 2020 04:13
Safari Readling List to Instapaper CSV (Ruby script for Mac)
# 1. Open Terminal.app.
# 2. Type "cd Desktop" and Enter.
# 3. Type "open ~/Library/Safari/" and Enter.
# 4. Hold Option key and drag-and-drop (i.e. copy) Bookmarks.plist to the Desktop.
# 5. Back to the Terminal, type "ruby safari-readling-list-to-instapaper-csv.rb" and Enter.
# 6. Open Instapaper Settings (https://www.instapaper.com/user), and select "Import from Instapaper CSV."
# 7. Upload Safari-Reading-List.csv on the Desktop.
require "plist"
require 'csv'
@zerobase
zerobase / .gitignore
Last active May 21, 2020 06:32
課税所得に対する所得税額を返す (計算根拠: 国税庁タックスアンサーNo.2260 所得税の税率 https://www.nta.go.jp/taxes/shiraberu/taxanswer/shotoku/2260.htm)
node_modules/
@zerobase
zerobase / fix_cask.sh
Created October 27, 2016 06:26
Fix Homebrew Cask application links (one-liner for zsh)
#!/bin/zsh
src=/opt/homebrew-cask; dst=/usr/local; for f in ~/Applications/*.app; do [ -h $f ] && l=$(readlink $f); ln -sf ${l/$src/$dst} $f; done
@zerobase
zerobase / kinokuniya_stock.js
Created July 7, 2016 12:52
紀伊國屋在庫検索ブックマークレット Amazon.co.jp用
javascript:var%20d=document,h='#form-contents',f='https://www.kinokuniya.co.jp/disp/CKnSfStockSearchStockView',l=d.location,b0='978'+l.href.match('https://www.amazon.co.jp/.*(?:dp|product)/([0-9X]{10})/')[1].substr(0,9),bn=b0+(10-(b0.split('').map((x,i)=>(xx=parseInt(x),(i%252==0)?xx:xx*3)).reduce((acc,cur)=>acc+cur,0)%2510)),e=encodeURIComponent,p='.jsp?CAT=01&GOODS_STK_NO='+e(bn)+'&MAN_ENTR_CD1=G2';1;try{if%20(!/^(.*\.)?kinokuniya\.[^.]*$/.test(l.host))throw(0);share_internal_bookmarklet(p)}catch(z)%20{a=function()%20{if%20(!window.open(f+p+h,'stockinfo','toolbar=0,status=0,resizable=1,width=700,height=500'))l.href=f+p+h};if%20(/Firefox/.test(navigator.userAgent))setTimeout(a,0);else{a()}}void(0)
@zerobase
zerobase / morning-relay.jade
Last active August 29, 2015 14:17
Morning Relay by Shuntaro Tanigawa
html
title Morning Relay by Shuntaro Tanigawa
script(src="//cdnjs.cloudflare.com/ajax/libs/jquery/2.1.3/jquery.min.js")
body.world
#kamchatka.place
.person.guy.is-dreaming.giraffe
.clock
audio(src="alarm-kamchatka-boy.mp3").alarm
#mexico.place
.person.maiden.is-waiting(for="bus")
@zerobase
zerobase / gist:8536743
Last active January 3, 2016 23:39
Chaplin/Backbone謎の擬似コード
class Homepage extends Chaplin.Model
_.extend @prototype, Chaplin.EventBroker
result: (val) ->
if val
publishEvent "change:result", result
getRemoteData: () ->
$.ajax () =>
@zerobase
zerobase / japanese_ime.html
Created December 10, 2013 01:41
"compositionstart" and "compositionend" events, and Japanese Input Method
<!DOCTYPE html>
<html>
<head>
<title>"compositionstart" and "compositionend" events, and Japanese Input Method</title>
</head>
<body>
<textarea name="textarea" id="textarea" cols="30" rows="3"></textarea>
<h2>onkeydown</h2>
<p>nowCompositioning: <span id="nowCompositioning"></span></p>
<p>keyCode: <span id="keyCode"></span></p>
class FooView extends View
constructor: (@jquery, @model) ->
super @jquery, @model
###
# Factory Method Example in CoffeeScript
## Introduction
This example of the factory method pattern is a part of a [Tic-tac-toe](http://en.wikipedia.org/wiki/Tic-tac-toe) application. See [Wikipedia](http://en.wikipedia.org/wiki/File:Factory_Method_UML_class_diagram.svg) for the UML diagram of the factory method pattern.
This example has four classes: Grid, GridCell, Board and Space.
@zerobase
zerobase / https-proxy.js
Created September 9, 2013 10:20
[nodejitsu/node-http-proxy#Proxying to HTTP from HTTPS](https://github.com/nodejitsu/node-http-proxy#proxying-to-http-from-https)
var fs = require('fs'),
https = require('https'),
httpProxy = require('http-proxy');
var options = {
https: {
key: fs.readFileSync('path/to/your/key.pem', 'utf8'),
cert: fs.readFileSync('path/to/your/cert.pem', 'utf8')
},
target: {