Skip to content

Instantly share code, notes, and snippets.

@stephenplusplus
stephenplusplus / subscribe.js
Last active August 29, 2015 14:23
gcloud subscription
'use strict';
var topicName = 'book-process-queue';
var subscriptionName = 'shared-worker-subscription';
var creatingSubscription = false;
var subscription;
var onMessageHandlers = [];
module.exports = function() {
@stephenplusplus
stephenplusplus / 0.md
Last active August 29, 2015 14:27
Measuring how different stream approaches perform
@stephenplusplus
stephenplusplus / npm-package-info.js
Created September 2, 2015 01:59
npm-package-info.js
'use strict';
var Q = require('q');
var packageJson = require('package-json');
var log = process.env.LOGGER || console;
module.exports = function (list) {
log.info('Fetching package info for %s packages', list.length);
@stephenplusplus
stephenplusplus / model.js
Last active October 20, 2015 18:44
firebase model
{
// PRIVATE DASHBOARDS:
"${projectId}:${userId}": {
"${dashboardId}": {
"modified": new Date(),
"plugins": [
{
"title": "Storage Browser",
"state": "storage-browser",
@stephenplusplus
stephenplusplus / proto-builder.js
Created October 27, 2015 18:13
proto-builder
#!/usr/bin/env node
'use strict';
var fs = require('fs');
var pbjs = require('protobufjs');
var commonJsExporter = require('protobufjs/cli/pbjs/targets/commonjs');
function build(protoFilePath, destinationJsFile) {
var fileContents = fs.readFileSync(datastoreProtoFile, 'utf-8');
'use strict';
var fs = require('fs');
var gcloud = require('gcloud');
var gcs = gcloud.storage({
projectId: 'nth-circlet-705',
keyFilename: '/Users/stephen/dev/keyfile.json'
});
@stephenplusplus
stephenplusplus / app.js
Last active December 14, 2015 12:08
DI thing.
// Create a module for the application.
var app = things('taptap');
// A "Service" is a once-instantiated, injectable dependency your app may need.
// "User" is a service that will handle the functionality of logging in and out
// a user. Note that it lists "Store" in the signature of the function. This
// will be caught by "thing.js" and injected into the function when it is
// called.
app.service('User', function(Store) {
// Generated on <%= (new Date).toISOString().split('T')[0] %> using <%= pkg.name %> <%= pkg.version %>
'use strict';
var LIVERELOAD_PORT = 35729;
var lrSnippet = require('connect-livereload')({port: LIVERELOAD_PORT});
var mountFolder = function (connect, dir) {
return connect.static(require('path').resolve(dir));
};
module.exports = function (grunt) {
// load all grunt tasks
t. .X
: :
|.. .|
;|... ..|/
BXii||:.. .:||i8@
@Iiiiii;||:.. ..:||/iiiiii%
XIiiiiiiit;||:.. ..:||/iiiiiiiiIt
IIiiiiiiiiiiSt|:.. ..:|SSIiiiiiiiiiIt8
ttIiiiiiiiiiiItiiiiiiiiiiitiiiiiiiiiiitttt
'use strict'
var PROJECT_ID = process.env.GCLOUD_PROJECT_ID
var BUCKET_NAME = process.env.GCLOUD_BUCKET
var fs = require('fs')
var gcloud = require('gcloud')({ projectId: PROJECT_ID })
var gcs = gcloud.storage()
var bucket = gcs.bucket(BUCKET_NAME)