Skip to content

Instantly share code, notes, and snippets.

Avatar

zato uiur

View GitHub Profile
View timeoutIfLast.coffee
app.service 'timeoutIfLast', [
'$q'
'$interval'
($q, $interval) ->
# delayの間, watchFnがtrueのまま持続したときに実行されるpromiseを返す
#
# @param {Function} watchFn
# @param {Number} delay ms
# @param {Number} [watchInterval] ms
# @return {Promise}
View gist:bbd17568350f62d23264
% rails c
Loading development environment (Rails 4.1.0)
irb(main):001:0> 1.month.ago + 1.month + 1.day
=> Thu, 01 May 2014 06:25:34 UTC +00:00
irb(main):002:0> 1.month.ago + 1.day + 1.month
=> Wed, 30 Apr 2014 06:25:47 UTC +00:00
@uiur
uiur / state.coffee
Created Jun 6, 2014
localStorageでブラウザの状態を同期するやつ
View state.coffee
# localStorageで状態を保存・同期するやつ
#
# example:
# State.set('key', 'value')
# State.on('key', (changedValue) ->
# update(changedValue)
# )
angular.module('state')
.service 'State', [
'localStorageService'
@uiur
uiur / DragData.coffee
Created Dec 30, 2014
DragData.coffee
View DragData.coffee
DragData =
set: (event, data) ->
transfer = event.originalEvent.dataTransfer
transfer.setData('text/drag-data', JSON.stringify(data))
get: (event) ->
data = event.originalEvent.dataTransfer.getData('text/drag-data')
try
View gyazo.plist
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>Gyazo</string>
<key>ProgramArguments</key>
<array>
<string>/Users/zat/bin/gyazo-key.rb</string>
</array>
View private.xml
<?xml version="1.0"?>
<root>
<vkopenurldef>
<name>KeyCode::VK_OPEN_URL_GYAZO</name>
<url type="file">/Applications/Gyazo.app</url>
</vkopenurldef>
<list>
<item>
<name>Private</name>
View gist:aaf988e3e30a167a8abf
Verifying that +uiu is my openname (Bitcoin username). https://onename.com/uiu
@uiur
uiur / nkf.rb
Last active Aug 29, 2015
euc-jp -> utf-8
View nkf.rb
require 'json'
list = Dir.glob('wiki/*.txt').map do |path|
title = `echo #{path} | xxd -r -p | nkf -E -w`
body = `cat #{path} | nkf -E -w`
{
title: title,
body: body
}
@uiur
uiur / ichi.sh
Created Apr 20, 2015
現在位置座標のURL開く
View ichi.sh
open "https://www.google.co.jp/maps/place/$(whereami --format sexagesimal | perl -MURI::Escape -ne 'print uri_escape($_)')"
@uiur
uiur / tty.sh
Created Apr 21, 2015
tty -> tty
View tty.sh
cat /dev/tty | tee /dev/ttys000
cat /dev/tty > /dev/ttys000