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 d; | |
// 1. JSDeferred風 | |
d = Deferred | |
.next(function() { | |
console.log('next1', Deferred.isDeferred(this), this === d); | |
}) | |
.next(function() { | |
console.log('next2', Deferred.isDeferred(this), this === d); | |
}); |
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 d = $.Deferred() | |
.done(function() { | |
console.log('done1', this === d); | |
}) | |
.done(function() { | |
console.log('done2', this === d); | |
}); | |
d.resolve(); | |
// "done1", true |
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
using terms from application "Mail" | |
on perform mail action with messages theMessages for rule theRule | |
tell application "Mail" | |
repeat with eachMessage in theMessages | |
set theSubject to (subject of eachMessage) | |
set theContent to (content of eachMessage) | |
set {year:y, month:m, day:d, time string:t} to (date sent of eachMessage) | |
set theDate to ((y * 10000 + m * 100 + d) as string) & " " & (t as string) | |
tell application "GrowlHelperApp" |
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
jQuery.tmpl.tag['script'] = { | |
open : "if('$2'){__.push('<script $2></script>');}else{__.push('<script>');}", | |
close: "__.push('</script>');" | |
}; |
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
$.fn.boxHeight = function() { | |
var target = [], | |
top = 0, | |
height = 0; | |
this.each(function() { | |
var self = $(this); | |
if (self.position().top != top) { | |
target.length > 1 && $(target).height(height); |
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 custom_interval_process = []; | |
function customInterval(callback, get_delay) { | |
var uid = custom_interval_process.length, | |
index = 0; | |
(function loop() { | |
custom_interval_process[uid] = w.setTimeout(function() { | |
++index; | |
callback(); |
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
# http://d.hatena.ne.jp/mollifier/20100906/p1 | |
autoload -Uz add-zsh-hook | |
autoload -Uz colors | |
colors | |
autoload -Uz vcs_info | |
zstyle ':vcs_info:*' enable git svn hg bzr | |
zstyle ':vcs_info:*' formats '(%s)-[%b]' | |
zstyle ':vcs_info:*' actionformats '(%s)-[%b|%a]' | |
zstyle ':vcs_info:(svn|bzr):*' branchformat '%b:r%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
on run {input, parameters} | |
if length of input ≤ 1 then | |
try | |
do shell script "/usr/local/bin/growlnotify -a Evernote -t \"Clip Images\" -m \"Image not found\"" | |
end try | |
return | |
end if | |
tell application "Evernote" | |
if (not (notebook named "Inbox" exists)) then |
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
require 'rake' | |
require 'css_splitter' | |
desc 'split css files' | |
namespace :css do | |
task :split do | |
infile = ENV['infile'] || raise("missing infile") | |
outdir = ENV['outdir'] || File.dirname(infile) | |
max_selectors = ENV['max_selectors'] || 4095 |
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
on growl(str, image_file) | |
if image_file is false then | |
set icon to "-a 'Tumblr Backup'" | |
else | |
set icon to "--image " & quoted form of (POSIX path of (image_file as text)) | |
end if | |
try | |
do shell script "/usr/local/bin/growlnotify " & icon & " -t \"Tumblr to Evernote\" -m " & quoted form of str | |
end try | |
end growl |