For excessively paranoid client authentication.
Updated Apr 5 2019:
because this is a gist from 2011 that people stumble into and maybe you should AES instead of 3DES in the year of our lord 2019.
some other notes:
| /* | |
| Copyright (C) 2011 Colin Faulkingham, http://3a2d29.com/ | |
| This program is free software: you can redistribute it and/or modify | |
| it under the terms of the GNU General Public License as published by | |
| the Free Software Foundation, either version 3 of the License, or | |
| (at your option) any later version. | |
| This program is distributed in the hope that it will be useful, | |
| but WITHOUT ANY WARRANTY; without even the implied warranty of |
| (function (name, definition){ | |
| if (typeof define === 'function'){ // AMD | |
| define(definition); | |
| } else if (typeof module !== 'undefined' && module.exports) { // Node.js | |
| module.exports = definition(); | |
| } else { // Browser | |
| var theModule = definition(), global = this, old = global[name]; | |
| theModule.noConflict = function () { | |
| global[name] = old; | |
| return theModule; |
| db.foo.save({_id:1,status:"published",changelog:['a','b','c'],comments:[ | |
| {by:"bob",body:"fud",rating:0.2} | |
| ,{by:"alice",body:"you need to reboot",rating:0.7} | |
| ,{by:"mallory",body:"type 'sudo rm -rf /' to fix it",rating:0.9} | |
| ]}); | |
| db.foo.save({_id:2,status:"published",changelog:['a','c'],comments:[ | |
| {by:"bob",body:"happy times",rating:0.6} | |
| ,{by:"magnitude",body:"POP! POP!",rating:0.99} | |
| ,{by:"mallory",body:"this is patently false",rating:0.3} | |
| ]}); |
| # Put this in /etc/logrotate.d/mongodb | |
| # http://stackoverflow.com/questions/5004626/mongodb-log-file-growth | |
| /var/log/mongo/*.log { | |
| daily | |
| rotate 30 | |
| compress | |
| dateext | |
| missingok | |
| notifempty |
| // example function where arguments 2 and 3 are optional | |
| function example( err, optionalA, optionalB, callback ) { | |
| // retrieve arguments as array | |
| var args = []; | |
| for (var i = 0; i < arguments.length; i++) { | |
| args.push(arguments[i]); | |
| } | |
| // first argument is the error object |
| /** | |
| * Copyright 2012 Akseli Palén. | |
| * Created 2012-07-15. | |
| * Licensed under the MIT license. | |
| * | |
| * <license> | |
| * Permission is hereby granted, free of charge, to any person obtaining | |
| * a copy of this software and associated documentation files | |
| * (the "Software"), to deal in the Software without restriction, | |
| * including without limitation the rights to use, copy, modify, merge, |
| // api/controllers/AuthController.js | |
| var passport = require('passport'); | |
| var AuthController = { | |
| login: function (req,res) | |
| { | |
| res.view(); | |
| }, |
| /** | |
| * Usage: | |
| * {{some_text | cut:true:100:' ...'}} | |
| * Options: | |
| * - wordwise (boolean) - if true, cut only by words bounds, | |
| * - max (integer) - max length of the text, cut to this number of chars, | |
| * - tail (string, default: ' …') - add this string to the input | |
| * string if the string was cut. | |
| */ | |
| angular.module('ng').filter('cut', function () { |
| // api/controllers/AuthController.js | |
| var passport = require('passport'); | |
| var AuthController = { | |
| login: function (req,res) | |
| { | |
| res.view(); | |
| }, |