Tuesday, December 30, 2008

0d6d98

Saturday, December 13, 2008

simple clone of GitHub Badge

Thanks to jQuery, I just spend three hours to create GitHub Widget, a clone of GitHub Badge. The widget is put in the sidebar of this page.



Compare with GitHub Badge, GitHub Widget is full written in jQuery, so that it is also compatible with IE. And the usage and html structure is full compatible with GitHub Badge.

I host it here temporarily. Please feel free to use it.

 

github api callback

Not documented on Official GitHub API Guide, GitHub provide "callback" parameter to allow corss-site json accessing.

Example in jQuery:
<script src='http://ajax.googleapis.com/ajax/libs/jquery/1.2.6/jquery.min.js' type="text/javascript"></script>

<script>

function myFunction(data) {
// data is the json we would get
}

$.getScript("http://github.com/api/v1/json/username?callback=myFunction")

</script>


 

hide blogger navigation bar

memo:

.Navbar {
visibility:hidden;
display: none;
}


 

Thursday, November 6, 2008

perl work with growl

Excerpt from
http://oreilly.com/catalog/9780596526740/toc.html
and
http://search.cpan.org/~cnandor/Mac-Growl-0.67/lib/Mac/Growl.pm

A quick method to post notification to Growl.


#!/usr/bin/env perl

use warnings;
use strict;

use Mac::Growl qw(:all);

Mac::Growl::RegisterNotifications(
# register your application in Growl before posting.
# just one time enough.
'growlalert', # app name
['alert'], # all notification
['alert'], # default notification
);

Mac::Growl::PostNotification(
# post notification to Growl
"growlalert", # app name
"alert", # notification type
"this is a title", # alert title
"this is a description", # alert content
);


 

Monday, October 13, 2008

push in scheme


01 (define push
02 (lambda (element stack)
03 (append stack (cons element '()))))
04
05 (push 'd '(a b c)) ; => (a b c d)


Though putting element before stack is a little weird XD.

 

Wednesday, September 17, 2008

tip in mpb

Defect mode always appears around the number of super lattice cells, so set num-bands automatically is a better way if we do not confirm how big the supper lattice.

e.g.
(define-param supercell-x 5)
(define-param supercell-y 11)
(set! num-bands (+ 2 (* supercell-x supercell-y)))


 

Saturday, September 6, 2008

emacs.app

the default color scheme looks more beautiful in emacs.app. :D

From temp

Wednesday, September 3, 2008

expand tab

emacs: (setq-default indent-tabs-mode nil)
vim: set expandtab

but I could not find the setting in textmate :~