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
// This code is MIT licensed: http://creativecommons.org/licenses/MIT/ | |
// Zenbe Inc (2009). | |
// Ensure our Zenbe namespaces exist. | |
window.zen = window.zen || {}; | |
window.zen.util = window.zen.util || {}; | |
/** | |
* The DropManager class provides a pleasant API for observing HTML5 drag-n-drop | |
* events, cleaning up the data that they return, and triggering the appropriate |
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
====================================================== | |
Setting up Django using Apache/mod_wsgi on Ubuntu 8.10 | |
====================================================== | |
This article will cover setting up Django using Apache/mod_wsgi on Ubuntu | |
8.10. The article is targeted at a production environment, but keep in mind | |
this is a more generalized environment. You may have different requirements, | |
but this article should at least provide the stepping stones. | |
The article will use distribution packages where nesscary. As of 8.10 the |
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
""" | |
This fabric file makes setting up and deploying a django application much | |
easier, but it does make a few assumptions. Namely that you're using Git, | |
Apache and mod_wsgi and your using Debian or Ubuntu. Also you should have | |
Django installed on your local machine and SSH installed on both the local | |
machine and any servers you want to deploy to. | |
_note that I've used the name project_name throughout this example. Replace | |
this with whatever your project is called._ |
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
#!/bin/bash | |
echo "Setting up chef..." | |
sudo apt-get -y update | |
sudo apt-get -y install ruby ruby1.8-dev libopenssl-ruby1.8 rdoc ri irb build-essential wget ssl-cert | |
cd /tmp | |
wget http://rubyforge.org/frs/download.php/57643/rubygems-1.3.4.tgz | |
tar zxf rubygems-1.3.4.tgz |
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
" DELIMITERS MADE LESS ANNOYING | |
" | |
" Main novelty here (if it is one): this does NOT try to be helpful by | |
" inserting the closing delimiter for you when you type an opening one. | |
" Instead it only tries to be smart about what to do when you type a closing | |
" delimiter yourself. | |
" | |
" If you just typed an empty delimiter pair, it'll move the cursor back | |
" inside. If you type a closing delimiter the cursor is already on (or to | |
" the left of, if the cursor is on a space), it'll skip the cursor past that |
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 -*- | |
""" | |
Example Usage | |
============= | |
>>> import datetime | |
>>> start = datetime.date(2009, 6, 21) | |
>>> g1 = daterange(start) |
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
jmh @ shinygecko: ~/projects/cassandra_client (master) | |
→ irb -r lib/cassandra | |
irb(main):001:0> c = Cassandra.new('Twitter'); c.get(:Tweets, 'first') | |
=> #<OrderedHash {"text"=>"omg no wai"}> | |
.... | |
jmh @ shinygecko: ~/projects/hadoop-0.20.0 | |
→ ./bin/hadoop jar \ | |
~/projects/build_cassandra/cassandra/build/apache-cassandra-incubating-examples-0.4.0-dev.jar \ |
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
- simple | |
- public over private | |
- personal vanity | |
- internet is global | |
- permalinks | |
- one important item per page | |
- don't break the browser | |
- don't wanker in technology | |
- a medium is not a grande | |
- break convention for your users |
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
" Inspired by: http://www.codekoala.com/blog/2009/even-more-new-vim-fun/ | |
" In order to be not pollute the namespace, I've added a dj for | |
" all django snippets. Here's the list so far: | |
" content blocks | |
" usage: content djbl<space> | |
ab djbl <Esc>bi{% block <Esc>ea %}{% endblock %}<Esc>h%i | |
" cycle |
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
import logging | |
import sys | |
if __name__ == "__main__": | |
if len(sys.argv) != 2: | |
print '%s <nodes>' % sys.argv[0] | |
sys.exit(1) | |
maxtokenvalue = 2**127 | |
numberofnodes = int(sys.argv[1]) |