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 Google Maps 3 Plugin (by forestk) | |
Copyright (C) 2010 forestk <http://www.forestk.com/> | |
Code licensed under the MIT License <http://www.opensource.org/licenses/mit-license.php> | |
Date: 2010-03-18 | |
@author forestk <http://www.forestk.com/> | |
@version 0.91 | |
-----------------------------------------------------*/ |
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
(* Growl Toggler *) | |
(* based on http://veadardiary.blog29.fc2.com/blog-entry-2449.html *) | |
tell application "System Events" | |
set isRunning to (count of (every process whose name is "GrowlHelperApp")) > 0 | |
end tell | |
if isRunning then | |
tell application "GrowlHelperApp" | |
set the allNotificationsList to {"Growl Toggler"} |
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
def createFlipFlop(): | |
def inner(): | |
inner.p = not inner.p | |
return inner.p | |
inner.p = 0 | |
return inner | |
ff = createFlipFlop() | |
print ff() | |
print ff() |
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
# -*- coding: utf-8 -*- | |
import plurk | |
import plurk_api_urllib2 | |
import simplejson | |
def do(key, username, password): | |
# login | |
api = plurk_api_urllib2.PlurkAPI(key) |
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
# -*- coding: utf-8 -*- | |
fb = ((lambda n: str(n), lambda n: 'Buzz'), (lambda n: 'Fizz', lambda n: 'FizzBuzz')) | |
for n in range(1, 101): | |
print fb[n % 3 == 0][n % 5 == 0](n) |
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://qiita.com/items/857 | |
(define (xpl xs) | |
(let loop ((xs (reverse xs)) (ys '())) | |
(if (null? xs) (reverse ys) | |
(loop (cdr xs) (append ys (list (reverse xs))))))) |
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
# -*- coding: utf-8 -*- | |
# http://d.hatena.ne.jp/JunichiIto/20111102/1320253815 | |
A = ord('A') | |
N = ord('Z') - A + 1 | |
def to_n(expr): | |
return reduce(lambda n, c: n * N + ord(c) - A + 1, expr, 0) | |
def to_aa(n): |
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
javascript:(function(x,d,t,n){try{t=yt.config_.PLAYER_REFERENCE.getCurrentTime()|0;for(n=0;n<3;++n){d=Math.pow(60,2-n);x[n*2]=(t/d)|0;t=t%d;}location.href=location.href.replace(/#.*/,'')+'#t='+x.join('');}catch(e){}})([0,'h',0,'m',0,'s']) |
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
def deal(n, xs): | |
ys = [''] * n | |
for i in range(len(xs) // n * n): | |
ys[i % n] += xs[i] | |
return ys | |
assert deal(3, '123123123') == ['111', '222', '333'] | |
assert deal(3, '123123123') == ['111', '222', '333'] | |
assert deal(4, '123123123') == ['12', '23', '31', '12'] | |
assert deal(6, '012345012345012345') == ['000', '111', '222', '333', '444', '555'] |
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
(use srfi-1) | |
(define (deal n s) | |
(let* ((size-s (string-size s)) | |
(max-xs (- size-s (remainder size-s n))) | |
(xs (take (string->list s) max-xs)) | |
(ys (make-vector n '()))) | |
(let loop ((m 0) (xs xs)) | |
(if (null? xs) | |
(map (lambda (xs) (list->string (reverse xs))) (vector->list ys)) | |
(begin |
OlderNewer