This file contains hidden or 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
| # HOW-TO: cross-domain communication with postmessage | |
| ## with iframes, CORS is a pita, this works instead | |
| window parent is on foo.com: | |
| var iframeHost = 'http://bar.com', |
This file contains hidden or 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
| our(%Type,%Enum); | |
| use constant { | |
| str => '', | |
| int => '', | |
| float => '', | |
| array => '', |
This file contains hidden or 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
| # find a message in skype DB yo | |
| # usage: | |
| # skype_grep hello%world | |
| # skype_grep hello%world -i << case insensitive | |
| # skype_grep | cat -n << all msgs. | |
| # skype_grep | grep 'Group Name' | less << all msgs in a particular chat | |
| # | |
| # main.db found on macos at Library/Application Support/Skype/<skype_username> | |
| TARGET='body_xml' | |
| [ $2 ] && TARGET='LOWER(body_xml)' |
This file contains hidden or 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
| #!/usr/bin/env perl | |
| use common::sense; | |
| use JSON::XS; | |
| my @msg; | |
| my $cmd = qq! git log --name-status --pretty=format:'{ \"sha\":\"%h\", \"commit\": \"%H\", \"author\": \"%an <%ae>\", \"date\": \"%ad\",\"message\": \"%s\",\"timestamp\":%at }'!; | |
| my $fh; |
This file contains hidden or 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
| create table furballs ( name varchar, data OID); | |
| insert into furballs values('aaa', lo_import('/tmp/blah.tgz')); | |
| select * from furballs; | |
| select lo_export(furballs.data, '/tmp/aaa.tgz') from furballs where name = 'aaa'; | |
| -- md5sum /tmp/*.tgz <-- are they the same? |
This file contains hidden or 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
| <!-- source: http://news.ycombinator.com/item?id=4876221 --> | |
| <!-- Async Tracking Code - http://code.google.com/intl/en-US/apis/analytics/docs/tracking/asyncTracking.html --> | |
| var _gaq = _gaq || []; | |
| _gaq.push(['_setAccount', 'YOUR ANALYTICS ID GOES HERE']); | |
| _gaq.push(['_trackPageview']); | |
| //******************* | |
| // Trick #1: Track page load time in Google Analytics | |
| // (note: only works for HTML5 browsers) |
This file contains hidden or 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
| #!/bin/env perl | |
| use strict; | |
| use warnings; | |
| sub cidr($) { (2**(32- shift) ) }; | |
| sub dec2ip($) { | |
| join '.', unpack 'C4' => pack 'N' => shift; | |
| } |
This file contains hidden or 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
| # Q: what is the fastest way to init. hash vars? | |
| # $^ = 5.14.2 | |
| use Benchmark qw(:all) ; | |
| my $op_x = sub { | |
| my %r = ( | |
| foo => 100, | |
| bar => 101, | |
| ); |
This file contains hidden or 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
| <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" | |
| "http://www.w3.org/TR/html4/loose.dtd"> | |
| <html> | |
| <head> | |
| <title></title> | |
| </head> | |
| <body> | |
| <script id="searchResultTemplate" type="text/x-jquery-tmpl"> | |
| {{each(i,result) hits}} |
This file contains hidden or 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
| #!/bin/bash | |
| # this lives wherever all your repos are; eg. ~/sandbox | |
| # | |
| D=`date`; | |
| LOG=LOG.git_update | |
| echo "============update $D==============" |tee -a $LOG; | |
| for i in `ls`; do |
NewerOlder