Skip to content

Instantly share code, notes, and snippets.

View yoko's full-sized avatar
🍐
I like pear

yksk yoko

🍐
I like pear
View GitHub Profile
@yoko
yoko / gist:2352527
Created April 10, 2012 16:14
Tumblr to Evernote
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
@yoko
yoko / css_splitter.rake
Created March 27, 2012 12:35 — forked from ChristianPeters/css_splitter.rake
Split CSS files so that there are no more than a given number of selectors in one style sheet. This is a tool to cope with Internet Explorer's limitation of max. 4095 selectors per stylesheet.
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
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
# 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'
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();
$.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);
jQuery.tmpl.tag['script'] = {
open : "if('$2'){__.push('<script $2></script>');}else{__.push('<script>');}",
close: "__.push('</script>');"
};
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"
var d = $.Deferred()
.done(function() {
console.log('done1', this === d);
})
.done(function() {
console.log('done2', this === d);
});
d.resolve();
// "done1", true
@yoko
yoko / gist:1018299
Created June 10, 2011 05:49
JSDeferred and $.Deferred
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);
});