This is pretty simple, lets dive in!
Find a name that isn't taken and clearly describes what your module is doing
$ npm view your-first-node-module
Ok, so you've built your first module, but now you want to make it use one of the many libraries available via the npm registry.
There are a few ways to find a module. You can use http://npmjs.org or http://npmsearch.com to find modules that may fit what you need.
(function() { | |
var scriptURI = prompt('Enter your script','https://gist.githubusercontent.com/NeoTech/6778e791e297151dd4a5/raw/b4604119b690d797ae350e0f6ef6eaa5775b07f1/screenshot.js'); | |
var callback = prompt('Enter a Callback', "(function() { console.log('Script loaded'); })"); | |
var getScript = (function getScript(url,success) { | |
var head=document.getElementsByTagName('body')[0],done=false; | |
var script=document.createElement('script'); | |
script.src=url; | |
script.onload=script.onreadystatechange=function(){ | |
if(!done && (!this.readyState || this.readyState=='loaded' || this.readyState=='complete')) { | |
done=true; |
#-- Loop through subfolders shenaningans and unrar every bloody archive you find. | |
for /r "./" %i in (`dir *.rar /s/b`) do 7z x %i |
/** This is a common question im running into, what is the difference between a promise design pattern and a middleware.. **/ | |
/* This pattern is commonly found in connect, koa, express and other middleware based frameworks. */ | |
/* This is not a hook pattern with pre/post */ | |
function Middleware() { | |
if (!(this instanceof Middleware)) { | |
if (global.MODE_LVL < 5) { | |
console.log('Not an instance; returning new callbackStack Client'); | |
} | |
return new Middleware(); |
/** | |
* Created by WARMACHINE on 2015-09-22. | |
*/ | |
// Example of code execution in a asynchron enviroment | |
// For simulate lag from db, timeouts will be used. | |
console.log('I will execute first'); | |
var delay1 = 0; | |
setTimeout((function() { |
var EventEmitter = require('events').EventEmitter; | |
function EventProto() { | |
if (!(this instanceof EventProto)) { | |
console.log('Not an instance; returning new.'); | |
return new EventProto(); | |
} | |
EventEmitter.call(this); | |
var _self = this; | |
} |
Object.deepExtend = function(destination, source) { | |
for (var property in source) { | |
if (source[property] && source[property].constructor && source[property].constructor === Object) { | |
destination[property] = destination[property] || {}; | |
arguments.callee(destination[property], source[property]); | |
} else { | |
destination[property] = source[property]; | |
} | |
} | |
return destination; |
/** | |
This creates a factory with the objective to make less code for repetitive tasks. | |
Normal way would have been to code each of these functions individually. | |
Instead we createa currying function that acts as a factory. | |
**/ | |
function UnitConversion() { | |
// Takes single object. | |
var args = Array.prototype.slice.call(arguments); | |
if(args[0].length > 0) { |
#!/usr/bin/perl | |
# http://cpansearch.perl.org/src/HMBRAND/Text-CSV_XS-1.01/examples/csv2xls | |
# csv2xls: Convert csv to xls | |
# (m)'11 [06 Oct 2011] Copyright H.M.Brand 2007-2013 | |
# modified 09/24/2013-11/05/2013 David Rotman, Cedarville University | |
# Many of these changes are stylistic changes based on personal preferences. | |
# The original script by H.M.Brand can be used without concern for accurateness | |
# and functionality. |