Skip to content

Instantly share code, notes, and snippets.

View mbroadst's full-sized avatar

Matt Broadstone mbroadst

View GitHub Profile
r.db('mydb').table('blah')
.filter(function(doc) {
return doc('foo').filter({ id: 'thingYouWant' }).count().ne(0);
})
function doThing(key) {
var updateData = {};
updateData[key] = r.row(key).add(1);
return r.db('test').table('blah').get("350226c0-5572-42a9-9d31-e5658d1392e7")
.update(updateData);
}
@mbroadst
mbroadst / box-layout-idea.js
Created December 2, 2015 22:32
idea/desire for box layouts
var blessed = require('blessed');
var form = blessed.form({ width: 200, height: 200 });
var formLayout = blessed.boxlayout({ direction: 'vertical' });
formLayout.append(blessed.label({ content: 'Name:' }));
formLayout.append(blessed.textbox({ name: 'name' }));
formLayout.append(blessed.label({ content: 'Birthday:' }));
formLayout.append(blessed.textbox({ name: 'birthday' }));
formLayout.append(blessed.line({ direction: 'horizontal' }));
'use strict';
function createType() {
function Thing() {};
Thing.prototype = Object.create(Object.prototype, {
first: { value: 1, enumerable: true, writable: true, configurable: false },
second: { value: 2, enumerable: true, writable: true, configurable: false }
});
return Thing;
};
// with defined properties
function accessors(index) {
return {
enumerable: true, configurable: false,
get: function() { return this._value[index]; },
set: function(value) { this._value[index] = value; }
};
}
function defineTypeWithDefinedProperties(fields) {
@mbroadst
mbroadst / app.html
Last active April 18, 2016 16:57 — forked from jdanyow/app.html
Aurelia simple grid example
<template>
<require from="./grid/grid"></require>
<require from="./grid/column"></require>
<grid rows.bind="people">
<column>${$index}</column>
<column>${firstName}</column>
<column>${lastName}</column>
</grid>
</template>
@mbroadst
mbroadst / app.html
Last active March 8, 2016 22:22 — forked from jdanyow/app.html
Aurelia simple grid example
<template>
<require from="./grid/grid"></require>
<require from="./grid/column"></require>
<grid view-model.ref="grid" rows.bind="people" class="table table-condensed table-bordered">
<column header="index">${$index}</column>
<column header="first name">${firstName}</column>
<column header="last name">${lastName}</column>
</grid>
</template>
@mbroadst
mbroadst / app.html
Last active March 10, 2016 13:35
Aurelia simple grid example
<template>
<require from="my-element"></require>
<my-element></my-element>
</template>
@mbroadst
mbroadst / main.js
Created March 14, 2016 19:52
breaks nexe packaging - `No such native module`
'use strict';
const fs = require('fs'),
path = require('path');
let modules = [], modulePath = path.join(__dirname, 'modules');
fs.readdir(modulePath, (err, files) => {
files
.filter(fileName => (fileName.indexOf('.') !== 0) && (fileName !== 'index.js'))
.map(fileName => require(path.join(modulePath, fileName))());
});
#include <qpid/messaging/Connection.h>
#include <qpid/messaging/Message.h>
#include <qpid/messaging/Receiver.h>
#include <qpid/messaging/Session.h>
#include <jsoncpp/json/reader.h>
#include <vector>
#include <string>
#include <iostream>