Skip to content

Instantly share code, notes, and snippets.

@benzenwen
benzenwen / Jose20201102
Created November 3, 2020 04:32
For jose
https://share.icloud.com/photos/0w3YqvOVSuD_GWubI9k65WnoA
@benzenwen
benzenwen / justcode-suppoted.md
Created June 11, 2018 00:42
JustCode Supported Technologies

JustCode Supported Technologies

Last edited: 2018-06-10

Front End

  • jQuery HTML
  • Angular JS
  • React
  • React (multi-page)
  • Vue.js
  • Vue.js (multi-page)
@benzenwen
benzenwen / mupload.ps1
Last active December 26, 2015 00:39
Windows powershell script for uploading a directory to Joyent Manta
Param (
[alias("nl")]
[switch]
$NoLinks,
[alias("v")]
[switch]
$Verbose,
[alias("q")]
[switch]
$Quiet,
@benzenwen
benzenwen / kart-aggr.json
Last active December 22, 2015 12:28
An example aggregation on the public Kartlytics corpus. See http://kartlytics.com for details. Originally from https://github.com/davepacheco/kartlytics
{
"phases": [
{
"type": "map",
"assets": ["/manta/public/kartlytics/bin/video-metadata"],
"exec": "/assets/manta/public/kartlytics/bin/video-metadata /$MANTA_USER/public $MANTA_INPUT_FILE"
},
{
"type": "reduce",
"exec": "json -g | mpipe /$MANTA_USER/public/kartlytics-summary.json"
@benzenwen
benzenwen / manta.txt
Last active December 20, 2015 10:19
Joyent Manta command to convert from JPG to webp using ImageMagick's convert.
mfind -t o -n JPG /$MANTA_USER/stor/pictures | mjob create -w -m 'convert -quality 50 -define webp:lossless=true $MANTA_INPUT_FILE /var/tmp/out.webp && mpipe ${MANTA_INPUT_OBJECT%.*}.webp < /var/tmp/out.webp'
@benzenwen
benzenwen / gist:6114751
Created July 30, 2013 16:53
Joyent Manta command to convert from JPG to webp using ImageMagick's convert.
mfind -t o -n JPG /$MANTA_USER/stor/pictures | mjob create -w -m 'convert -quality 50 -define webp:lossless=true $MANTA_INPUT_FILE /var/tmp/out.webp && mpipe ${MANTA_INPUT_OBJECT%.*}.webp < /var/tmp/out.webp'
@benzenwen
benzenwen / mongolab-nodeknockout.md
Created November 8, 2012 22:53
MongoLab Joyent-hosted MongoDB

MongoLab Joyent-hosted MongoDB

This is the 16th in series of posts leading up Node.js Knockout, and covers provisioning MongoLab for use in your node app.

@benzenwen
benzenwen / gist:3297233
Created August 8, 2012 18:17 — forked from esedor/gist:1368293
Querying MongoDB in Node.JS
db.collection('quests', function(er, cl) {
cl.insert({'goal': 'Explore', 'lv': 1}, {safe: true}, function(er,rs) {
cl.update({'goal': 'Explore'},
{'$set': {'gold': 150}}, {safe: true}, function(er,rs) {
cl.find({'lv': {'$lte': 4}}).toArray(function (er,rs) {
console.log(rs);
}); }); }); });
@benzenwen
benzenwen / gist:3291079
Created August 8, 2012 00:58 — forked from esedor/gist:1368275
Connecting to MongoDB in Node.JS
var mongo = require('mongodb');
var mongoUri = 'mongodb://localhost:27017/mongoquest';
mongo.Db.connect(mongoUri, function (err, db) {
/* adventure! */
});
@benzenwen
benzenwen / aggregation.js
Created July 9, 2012 19:14 — forked from cwestin/aggregation.js
Mongo shell script and sample documents used for my aggregation talks 12/2011
// make sure we're using the right db; this is the same as "use aggdb;" in shell
db = db.getSiblingDB("aggdb");
// simple projection
var p1 = db.runCommand(
{ aggregate : "article", pipeline : [
{ $project : {
tags : 1,
pageViews : 1
}}