Skip to content

Instantly share code, notes, and snippets.

@VirtualWolf
VirtualWolf / .gitignore
Last active December 15, 2015 22:29 — forked from rpetrich/index.php
favicon.gif
favicon.ico
s

Keybase proof

I hereby claim:

  • I am virtualwolf on github.
  • I am virtualwolf (https://keybase.io/virtualwolf) on keybase.
  • I have a public key ASD6EpSL0pY44AXCVwXwyg0ToM3XAvoD31nXVaT_LfmRQAo

To claim this, I am signing this object:

@VirtualWolf
VirtualWolf / callbacks.js
Last active April 11, 2020 02:35
getPhotoMetadata() before and after
// Original version using callbacks and the entire setup in a single giant function
getPhotoMetadata: (options, callback) => {
async.parallel({
exif: cb => {
jsonService.getJsonFromUrl(baseRestUrlService.getUrl('flickr')
.addQueryParam('method', 'flickr.photos.getExif')
.addQueryParam('photo_id', options.photoId),
(err, data) => {
if (err) { return cb(err, null); }
if (data.stat === 'fail') { return cb(data.message, null); }
@VirtualWolf
VirtualWolf / 01_callbacks.js
Last active April 11, 2020 02:39
sendUpdate() before and after
// Original version using callbacks
sendUpdate: callback => {
const request = require('superagent');
HipChatWeather.find({})
.exec((HipChatWeatherModelError, results) => {
if (HipChatWeatherModelError) { sails.log.error(HipChatWeatherModelError); return callback(HipChatWeatherModelError, null); }
if (results.length === 0) { return callback(null, null); }
ninjaBlockService.getCurrentTemperatureAndHumidity({location: 'outdoor'}, (ninjaBlockServiceError, data) => {