Suggestions for improvements welcome!
const nonNavigableTarget = Symbol();
function safe(target, defaultValue) {| var forge = require('node-forge'); | |
| var fs = require('fs'); | |
| var moment = require('moment'); | |
| var filename = 'P12_FILE_PATH'; | |
| var password = 'PASSWORD'; | |
| var p12b64 = fs.readFileSync(filename, { encoding: 'base64' }); | |
| var p12Der = forge.util.decode64(p12b64); | |
| var p12Asn1 = forge.asn1.fromDer(p12Der); |
| 'use strict'; | |
| /** | |
| * Paginator Plugin(for mongoose) | |
| * | |
| * The MIT License (MIT) | |
| * Copyright (c) 2014 Shekhar R. Thawali<shekhar@leftshift.io> | |
| * | |
| * Permission is hereby granted, free of charge, to any person obtaining a copy | |
| * of this software and associated documentation files (the "Software"), to deal |
| 'use strict'; | |
| /** | |
| * Paginator | |
| * | |
| * The MIT License (MIT) | |
| * Copyright (c) 2014 Shekhar R. Thawali<shekhar@leftshift.io> | |
| * | |
| * Permission is hereby granted, free of charge, to any person obtaining a copy | |
| * of this software and associated documentation files (the "Software"), to deal |
| var regex = /^\d{0,3}(\.\d{1,2})?$/; // This will validate for (xxx.xx) format. | |
| if(regex.test(PRICE_VALUE)) { | |
| // Right format | |
| } else { | |
| // Wrong format | |
| } |
| /* Extract vido id and source from Youtube and Vimeo | |
| *****************************************************/ | |
| function extractVideoUrl(url) { | |
| var vimeoRegEx = /https?:\/\/(?:www\.)?vimeo.com\/(?:channels\/|groups\/([^\/]*)\/videos\/|album\/(\d+)\/video\/|)(\d+)(?:$|\/|\?)/; | |
| var youtubeRegEx = /(?:https?:\/{2})?(?:w{3}\.)?youtu(?:be)?\.(?:com|be)(?:\/watch\?v=|\/)([^\s&]+)/; | |
| function getId(url, type) { | |
| var match = url.match((type === 'youtube') ? youtubeRegEx : vimeoRegEx); | |
| alert(match); |
| var express = require('express'); | |
| var http = require('http'); | |
| var app = express(); | |
| var expressWinston = require('express-winston'); | |
| var winston = require('winston'); | |
| var fs = require('fs'); | |
| var app = express(); | |
| var server = http.createServer(app); |
| var express = require('express'); | |
| var http = require('http'); | |
| var app = express(); | |
| app.use( | |
| function handleError(req, res, next) { | |
| var domain = require('domain').create(); | |
| res.on('close', function() { | |
| domain.dispose(); |
| $('h1').bind('click', function() { | |
| this.log('clicked!'); | |
| }, console); | |
| $('h2').bind('click', {msg: 'clicked!'}, function(e) { | |
| this.log(e.data.msg); | |
| }, console); |