Some exercises from the Falsy Values workshops.
The good parts:
- HTTP server and client in same script
- Express cookies example
- Express routing example
- Express error handling
- Express middlewares example
- Simple HTTP proxy
| sudo apt-get install lvm2 | |
| sudo apt-get install mylvmbackup | |
| jhannah@li202-203:~/src$ sudo mylvmbackup --socket=/home/cm_satin/mysql-repl/mysql.sock | |
| 20110304 23:19:14 Info: Connecting to database... | |
| 20110304 23:19:14 Info: Running hook 'preflush' as perl module. | |
| 20110304 23:19:14 Info: Flushing tables with read lock... | |
| 20110304 23:19:14 Info: Taking position record into /tmp/mylvmbackup-backup-20110304_231914_mysql-hfUKiZ.pos... | |
| 20110304 23:19:14 Info: Running: lvcreate -s --size=5G --name=data_snapshot /dev/mysql/data | |
| File descriptor 4 (socket:[113294]) leaked on lvcreate invocation. Parent PID 1669: /usr/bin/perl |
| JSpec.describe 'ShoppingCart', -> | |
| before_each -> | |
| cart = new ShoppingCart | |
| describe 'addProducts', -> | |
| it 'should add several products', -> | |
| cart.addProducts('cookie') | |
| cart.addProducts('icecream') | |
| expect(cart).to(have, 2, 'products') |
| # vmc update is great for test and development, however it stops your old app and stages and starts the new one, | |
| # resulting in dropped requests. | |
| # If you want to update an application without dropping user requests, see below. | |
| # NOTE: This change assumes your application can share services, etc with the new version. | |
| # Assume my app is named foo | |
| vmc push foo-v2 --url foov2.cloudfoundry.com |
| #!/bin/sh | |
| # | |
| # Script to prepare and restore full and incremental backups created with innobackupex-runner. | |
| # | |
| # This script is provided as-is; no liability can be accepted for use. | |
| # | |
| INNOBACKUPEX=innobackupex-1.5.1 | |
| INNOBACKUPEXFULL=/usr/bin/$INNOBACKUPEX | |
| TMPFILE="/tmp/innobackupex-restore.$$.tmp" |
Some exercises from the Falsy Values workshops.
The good parts:
| # In general, there are many places in the file where you can leave off the parens in function calls, if you like. | |
| unless typeof exports is "undefined" # `unless ... else` reads poorly in English. Better to stick to `if ... else`. | |
| Spine = exports | |
| else | |
| Spine = @Spine = {} | |
| Spine.version = "0.0.4" | |
| $ = Spine.$ = @jQuery || @Zepto || -> arguments[0] # In Coffee, `or` is preferred over `||`. |
| require 'msgpack' | |
| module Goliath | |
| module Rack | |
| module Formatters | |
| # A MessagePack formatter. | |
| # @example | |
| # use Goliath::Rack::Formatters::MSGPACK | |
| class MSGPACK | |
| include AsyncMiddleware |
| jQuery.get('/templates/foo.handlebars', function(data) { | |
| var template = SC.Handlebars.compile(data); | |
| SC.TEMPLATES['foo'] = template; | |
| }) |
| Key was generated using: | |
| tom% openssl genrsa -des3 -out example.com.key 2048 | |
| Generating RSA private key, 2048 bit long modulus | |
| ....+++ | |
| ..........................................................................................................................+++ | |
| e is 65537 (0x10001) | |
| Enter pass phrase for example.com.key: | |
| Verifying - Enter pass phrase for example.com.key: | |
| %tom |