online cocktail napkin
links and notes for later organization
2008 Napkin
2007 Napkin
WordsIReallyLike
ThumbDrive
Questions for Strangers
$canvas = $('#sandbox');
$i = $('<iframe />');
$i.attr('src', 'http://google.com/').attr('width', '600').attr('height', '300').css('overflow', 'hidden').css('display', 'block').css('border','4px solid #ccc').css('padding','8px');
$canvas.append($i);
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^js\/?(.*)$ _js.htm?q=$1 [QSA,L]
RewriteRule ^rewrite(.*)\/?(.*)$ rewrite.php?q=$1 [QSA,L]
</IfModule>
http://search.twitter.com/search?q=lastgoogle∞
find ~/qed/ -maxdepth 4 -name "*.conf" | xargs perl -w -i -p -e "s/VirtualHost 127.0.0.1/VirtualHost */g"
Reconfigure as
Wikka Recent Changes Notifier∞ as a
handler∞
- enforce access through url: domain.com/wikka/$access_code/recent_changes
- add setting for $access_code
- check that url match $cron_code
- add setting for email, but default to wiki admin
- additional abuse check
- when called directly, display last
- on call, read page and parse out last_emailed.
- adding setting for max_frequency and if time() - last_emailed < $mail_no_more_than_every, exit
- upon email, edit page to include line: last_emailed=uts
- is it possible to pass additional parameters in the url? e.g. wikka/$access_code/recent_changes/3600 (for last 3600 s or 1 hr)
<?php
// handlers/page/test.php
$tpl = <<<XHTML
<div
class=
"page">
This is a test handler. To disable, delete the
file <tt>test.php</tt> from
<tt>/handlers/page/</tt> directory.
</div>
XHTML;
printf($tpl);
?>
PHP Mail Configuration∞
Wikka Slowness:
http://wikkawiki.org/ExtremeSlownessWorkaround∞
# copying svn dir sans svn dirs
$ rsync -r --exclude=.svn /path/to/svn_dir /tmp
komodo.assertMacroVersion(2);
if (komodo.view) { komodo.view.setFocus() };
path_ = gViewMgr.currentView.document.file.path;
if ( prompt( 'current file path', path_) )
komodo.view.selection = path_;
var D = {'a':1, 'b':2, 'c':1, 'd':3};
console.log('begin', D);
for ( k in D ) {
console.log('outer', k, ':', D[k]);
for ( k2 in D ) {
if ( k2 == k ) continue;
if ( D[k] != D[k2] ) continue;
console.log('removing dupe', k2, ':', D[k2] );
delete D[k2];
}
}
console.log('end', D);
Page was generated in 9.3332 seconds!
Komodo Current File Path
prompt('current file path', gViewMgr.currentView.document.file.path)
http://www.klenwell.com/press/2009/04/formencode-state/∞
http://www.phpied.com/3-ways-to-define-a-javascript-class/∞ /
http://www.prototypejs.org/learn/class-inheritance∞
json class:
<script type="text/javascript">
function Speaker () {
this.type = name;
this.speak = function(message) {
alert(message);
};
}
function Machine(type) {
this.type = type;
this.Speaker = new Speaker();
this.speak = function(message) {
this.Speaker.speak(this.type + ' : ' + message);
};
}
var iPod = {
Speaker: new Speaker(),
speak: function (message) {
this.Speaker.speak(message);
}
}
var iPhone = new Machine('iPhone');
iPhone.speak('support iTunes');
iPod.speak('hey, it worked!');
</script>
tax calculator calculations:
http://www.sacbee.com/1098/story/1627728.html∞
# A couple calculations
# Income $30k / Car $10k
Not Married: $192 -> monthly increase: $16 (2 Trips to McDonalds)
Married: $192
2 Kids: $612
# Income $100k / Car $25k
Not Married: $488 -> monthly: $40.67 (1 Video Game)
Married: $534
2 Kids: $954
# My actual numbers are somewhere in between
windansea 02.18 pm∞
/* background: color image repeat attachment position */
background: #FFCC66 url("file or url name") no-repeat fixed right bottom;
Plato's Symposium∞
mysqldump dbname | ssh user@remoteserver "cat - > dbname.db"
pastebin:
CakePhp Custom Pagination Methods
in case you missed 1978∞
perfect weather/dead ocean∞current∞
pastebin:
Klenwell CakePhp Form Helper
python regex (I could have sworn I pasted this here before):
import re
# compile
html = "'<html>\n<head>\n<title>Title</title>\n</head>\n</html>"
regex = re.compile('<.*?>',)
result = regex.search(html)
print result.group()
# ungreedy
html = "'<html><head><title>Title</title>"
print re.search('<.*?>', html).group()
# substitution
dirty = "some alphanum and some other ^$#%&*%!"
rgx = r'[^a-zA-Z0-9]' # alphanum only!
clean = re.sub(rgx, '', dirty)
CategorySpecial
There are no comments on this page. [Add comment]