The JSON data is in the following format
{
"Genesis": {
"1": {
"1": "In the beginning..." ,
"2": "..."
| #!/usr/bin/env ruby | |
| # Aside from removing Ruby on Rails specific code this is taken verbatim from | |
| # mislav's git-deploy (http://github.com/mislav/git-deploy) and it's awesome | |
| # - Ryan Florence (http://ryanflorence.com) | |
| # | |
| # Install this hook to a remote repository with a working tree, when you push | |
| # to it, this hook will reset the head so the files are updated | |
| if ENV['GIT_DIR'] == '.' |
| /** | |
| * Module import | |
| */ | |
| var express = require('express'); | |
| /** | |
| * Port the server listens on | |
| */ | |
| var port = 3000; |
| /* Find column in all databases */ | |
| DECLARE @db_name varchar(100), | |
| @col_name varchar(100), | |
| @sql_statement nvarchar(MAX) | |
| -- column you are looking for | |
| SET @col_name = 'PLANNED_SAMPLE_ID' | |
| -- fill cursor with database names |
| "use strict"; | |
| // `f` is assumed to sporadically fail with `TemporaryNetworkError` instances. | |
| // If one of those happens, we want to retry until it doesn't. | |
| // If `f` fails with something else, then we should re-throw: we don't know how to handle that, and it's a | |
| // sign something went wrong. Since `f` is a good promise-returning function, it only ever fulfills or rejects; | |
| // it has no synchronous behavior (e.g. throwing). | |
| function dontGiveUp(f) { | |
| return f().then( | |
| undefined, // pass through success |
| # install chef-solo one line ! | |
| curl -L https://www.opscode.com/chef/install.sh | bash | |
| # cookbooks have their rep: check the dir name == cookbook name | |
| mkdir -p /opt/cookbooks | |
| git clone https://github.com/hw-cookbooks/graphite | |
| git clone https://github.com/opscode-cookbooks/apache2.git | |
| git clone https://github.com/opscode-cookbooks/python.git | |
| git clone https://github.com/opscode-cookbooks/runit.git | |
| git clone https://github.com/opscode-cookbooks/memcached.git |
Press minus + shift + s and return to chop/fold long lines!
| // | |
| // Crude node.js longpoll example via a simple message queue | |
| // | |
| //-------------------- | |
| // app.js | |
| //-------------------- | |
| var queue = require('./queue/messagequeue'); | |
| app.get('/messages/:queueName/:lastMsgId', queue.getMessages); | |
| app.post('/messages/:queueName', queue.postMessages); |
When the directory structure of your Node.js application (not library!) has some depth, you end up with a lot of annoying relative paths in your require calls like:
const Article = require('../../../../app/models/article');Those suck for maintenance and they're ugly.
| #!/bin/bash | |
| # Sometimes you need to move your existing git repository | |
| # to a new remote repository (/new remote origin). | |
| # Here are a simple and quick steps that does exactly this. | |
| # | |
| # Let's assume we call "old repo" the repository you wish | |
| # to move, and "new repo" the one you wish to move to. | |
| # | |
| ### Step 1. Make sure you have a local copy of all "old repo" | |
| ### branches and tags. |