klenwell information services : SpecialCocktailNapkin

Revision [1060]

This is an old revision of SpecialCocktailNapkin made by KlenwellAdmin on 2009-06-17 13:55:17.
 

online cocktail napkin

links and notes for later organization
CocktailNapkin2008 2008 Napkin
CocktailNapkin2007 2007 Napkin
WordsIReallyLike
ThumbDrive
CocktailQuestions Questions for Strangers

<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
<?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: Paste20090117 CakePhp Custom Pagination Methods
in case you missed 1978
perfect weather/dead oceancurrent
pastebin: Paste20090110 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