This is a maintained listing of all the different ways to debug and profile Node.js applications. If there is something missing or an improvement, post a comment! :)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #! /usr/bin/env node | |
| const fs = require('fs'); | |
| const http = require('http'); | |
| const home = process.env.HOME; | |
| const options = { | |
| host: 'example.com', | |
| path: '/', |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // I can't figure out how to add custom text to the `payload` variable above. | |
| // I've tried: | |
| var accessRequest = "The following user wants to join WADE:" + contactHow | |
| var payload = { | |
| channel: "#botspam", | |
| username: "recruitbot", | |
| text: accessRequest, | |
| icon_emoji: ":raised_hands::skin-tone-4:" | |
| }; | |
| var options = { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // vendor | |
| var express = require('express'); | |
| var app = express(); | |
| // depending on the placement, we can either catch or override routes | |
| app.use(app.router); | |
| // every route in the routes/user.js file will be served under /user | |
| app.use('/user', require('./routes/user').middleware); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| define([ | |
| 'vent', | |
| 'routers/manage/groups', | |
| 'routers/manage/learners', | |
| 'controllers/manage/groups', | |
| 'controllers/manage/learners', | |
| 'views/layouts/manage/module', | |
| 'views/tab/collection', | |
| 'collections/client/tab' | |
| ], function ( |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Following the news about Facebook buying Instagram I decided to delete my Instagram account before Facebook claims ownership of my pictures. | |
| Since the Instagram-recommended (in their FAQ): http://instaport.me/export doesn't work for me (probably they can't cope with the high demand), | |
| here is a quick and dirty way to download all my Instagram pictures in their highest resolution in a few easy steps. | |
| You will need: Firefox, Firebug, some text editor, wget | |
| 1. Go to http://statigr.am/yourlogin using Firefox with Firebug extension active | |
| 2. Scroll down as many times as it is needed to have all yor pictures thumbnails displayed (I had some 3 hundred pictures so it was not that much scrolling, YMMV) | |
| 3. In the Firebug JS console run this JS code: $(".lienPhotoGrid a img").each(function(index) { console.log($(this).attr('src')) }) | |
| 4. JS console will contain urls to all the thumbnails images, like this: http://distilleryimage1.s3.amazonaws.com/4ed46cf2801511e1b9f1123138140926_5.jpg |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function interval(duration, fn){ | |
| this.baseline = undefined | |
| this.run = function(){ | |
| if(this.baseline === undefined){ | |
| this.baseline = new Date().getTime() | |
| } | |
| fn() | |
| var end = new Date().getTime() | |
| this.baseline += duration |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /* | |
| * Javascript EXIF Reader 0.1.4 | |
| * Copyright (c) 2008 Jacob Seidelin, [email protected], http://blog.nihilogic.dk/ | |
| * Licensed under the MPL License [http://www.nihilogic.dk/licenses/mpl-license.txt] | |
| */ | |
| var EXIF = {}; | |
| (function() { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| grunt.registerMultiTask('s3deploy', 'deploy to S3 using awssum', function () { | |
| // dependencies | |
| var awssum = require('awssum'), | |
| fs = require('fs'), | |
| path = require('path'), | |
| aws = require('./settings').aws; | |
| var amz = awssum.load('amazon/amazon'), | |
| AmazonS3 = awssum.load('amazon/s3'), | |
| s3 = new AmazonS3(aws.accessKey, aws.secretKey, aws.accountId , amz.US_EAST_1), |
This is a mini howto on moving a subdirectory to its own repository retaining history
Assume PARENT is the original parent Git repository (locally) and CHILD is the new local repository that you wish to create from a subdirectory, retaining all of its history from the PARENT repository; PARENT_PATH and CHILD_PATH are the paths to PARENT and CHILD respectively; SUBDIR is the relative path within the repository under extraction:
git clone --no-hardlinks PARENT_PATH CHILD_PATHpushd CHILD_PATH