Skip to content

Instantly share code, notes, and snippets.

View pauliusuza's full-sized avatar
🔥
On fire

Paulius Uza pauliusuza

🔥
On fire
View GitHub Profile

Cheat Sheet for the FoundationDB 'Hot Cloud Swap' Screencast

Initial Cluster Setup on Digital Ocean

Grab the client and server packages from the FoundationDB website

ansible -i inventory digital_ocean -a "wget https://foundationdb.com/downloads/f-nbxofdxnoxocd/I_accept_the_FoundationDB_Community_License_Agreement/key-value-store/2.0.9/foundationdb-clients_2.0.9-1_amd64.deb https://foundationdb.com/downloads/f-nbxofdxnoxocd/I_accept_the_FoundationDB_Community_License_Agreement/key-value-store/2.0.9/foundationdb-server_2.0.9-1_amd64.deb"

Install the client and server packages

<!DOCTYPE html>
<html lang='en'>
<head>
<script>
var Keen=Keen||{configure:function(e){this._cf=e},addEvent:function(e,t,n,i){this._eq=this._eq||[],this._eq.push([e,t,n,i])},setGlobalProperties:function(e){this._gp=e},onChartsReady:function(e){this._ocrq=this._ocrq||[],this._ocrq.push(e)}};(function(){var e=document.createElement("script");e.type="text/javascript",e.async=!0,e.src=("https:"==document.location.protocol?"https://":"http://")+"dc8na2hxrj29i.cloudfront.net/code/keen-2.1.0-min.js";var t=document.getElementsByTagName("script")[0];t.parentNode.insertBefore(e,t)})();
// Configure the Keen Client
Keen.configure({
projectId: "<your project ID>",
var mongoose = require('mongoose');
var Schema = mongoose.Schema;
var assert = require('assert')
console.log('\n===========');
console.log(' mongoose version: %s', mongoose.version);
console.log('========\n\n');

Pub/sub with MongoDB and Node.js

Setup:

$ mongo
> use pubsub
> db.createCollection('messages', { capped: true, size: 100000 })
> db.messages.insert({})
/* COMMON */
html, body { height:100%; margin:0; padding:0; background-color:#333; color:#000; }
body { -ms-text-size-adjust: 100%; }
.page { left: 0; right: 0; top: 0; bottom: 0; }
.row, .col, .page { overflow: hidden; position: absolute; }
.row { left: 0; right: 0; }
.col { top: 0; bottom: 0; }
.scroll-x { overflow-x: auto; }
.scroll-y { overflow-y: auto; }
@pauliusuza
pauliusuza / node_webkit_bug_152.log
Created November 7, 2012 23:49
node-webkit bug #152
Process: node-webkit [1364]
Path: /Applications/node-webkit.app/Contents/MacOS/node-webkit
Identifier: com.intel.nw
Version: 0.3.2 (???)
Code Type: X86 (Native)
Parent Process: bash [404]
Date/Time: 2012-11-08 01:46:21.970 +0200
OS Version: Mac OS X 10.7.5 (11G56)
Report Version: 9
@pauliusuza
pauliusuza / console.js
Created November 4, 2012 15:49
Javascript Output Console for Microsoft Visual Studio 2012 projects
/*
* Javascript Output Console for Microsoft Visual Studio 2012 projects
* @author Paulius Uza, [email protected]
* @license MIT
*
* Dependencies:
* JQuery 1.8.2
*
* Usage:
* console.log(var1, var2, var3, var4);
@pauliusuza
pauliusuza / Javascript Class
Created November 1, 2012 17:11
Javascript Class
/*jshint browser:true, jquery:true, undef:true, devel:true, unused:false, curly:true, strict:true,
noarg:true, noempty:true, eqeqeq:true, bitwise:true, quotmark:true, indent:2, maxerr:50 */
/*global window:true */
/**
Global Class collection with a class(klass) object with private and public variables/methods without using this.
@author John Doe
@namespace classLib
*/
@pauliusuza
pauliusuza / Snipppet Privacy Policy
Created October 27, 2012 11:02
Snipppet Privacy Policy
SNIPPPET PRIVACY POLICY
This application does not share personal information with third parties
nor does it store any information about you.
The on-demand code sharing feature enabled in this application does not
transmit your personal information and is completely anonymous.
This privacy policy is subject to change without notice and was last
updated on October 27, 2012. If you have any questions feel free to
@pauliusuza
pauliusuza / recursive.js
Created January 29, 2012 21:58
Recursive Function Pattern in JS
arr = [];
(function recurse(url, i) {
getNextUrl(url, function(err, nextUrl) {
if (!err) {
arr.push(nextUrl);
if (i < 100) recurse(nextUrl, i++);
}
});
}("", 0);