I hereby claim:
- I am steveinatorx on github.
- I am stevenbrezina (https://keybase.io/stevenbrezina) on keybase.
- I have a public key ASCVVM9t3-nlt8tqeeoZs_9bUM9x0slAZI9DVAQbUMNhiAo
To claim this, I am signing this object:
I hereby claim:
To claim this, I am signing this object:
| /* i needed to load a bunch of static filter arrays into an api route in node - express - | |
| so rather than making that DB call every time i ran the | |
| api route here is a keen pattern to require async - use require with a callback. | |
| This is a quick and easy way to do "poor man's server caching" with node in a server context | |
| */ | |
| require('./apiHelper').getOptFilter(function(err, filter){ | |
| console.log('i got the filter now load the rest of my route/module', filter); | |
| }); |
| // find the latest query that matches criteria in mongodb | |
| db.system.profile.find({ "op" : "command", "command.query.Criteria" : {"$exists": true} }, { "command" : 1}).limit(1).sort( { ts : -1 } ).pretty() |
| #!/bin/bash | |
| find . \( -name node_modules -prune \) -o -name "*.*" -exec grep --color -Hn $1 {} 2>/dev/null \; |
| 'use strict'; | |
| var apiDispatcher = require ('../apiDispatcher'); | |
| var request = require ('request'); | |
| var async = require ('async'); | |
| apiDispatcher.getURIs('foo.com') | |
| .then(function(res){ | |
| var uris=JSON.parse(res); | |
| async.each(uris, function(uri,tick){ |
| // NOTE: I previously suggested doing this through Grunt, but had plenty of problems with | |
| // my set up. Grunt did some weird things with scope, and I ended up using nodemon. This | |
| // setup is now using Gulp. It works exactly how I expect it to and is WAY more concise. | |
| var gulp = require('gulp'), | |
| spawn = require('child_process').spawn, | |
| node; | |
| /** | |
| * $ gulp server | |
| * description: launch the server. If there's a server already running, kill it. |
| var keystone = require('keystone'); | |
| var TheModel=keystone.list('TheModel'); | |
| var _=require('lodash'); | |
| exports.update=function(req, res) { | |
| TheModel.model.findOneAndUpdate({"id":req.params.id},{$set:req.body},{new:true},function(err, doc) { | |
| if (err) return res.apiError('error', err); | |
| res.apiResponse({ |
| <!DOCTYPE html> | |
| <html> | |
| <head> | |
| <script src="https://rawgit.com/lodash/lodash/3.0.1/lodash.min.js"></script> | |
| <meta charset="utf-8"> | |
| <title>JS Bin</title> | |
| </head> | |
| <body> | |
| <script id="jsbin-javascript"> |
| #fadingBarsG{ | |
| position:relative; | |
| width:100px; | |
| height:12px; | |
| display:inline-block; | |
| } | |
| .fadingBarsG{ | |
| position:absolute; | |
| top:0; |