| gitflow | git |
|---|---|
git flow init |
git init |
git commit --allow-empty -m "Initial commit" |
|
git checkout -b develop master |
| var mongoose = require("mongoose"); | |
| var ObjectId = mongoose.Schema.Types.ObjectId; | |
| //create schema for a post | |
| var PostSchema = new mongoose.Schema({ | |
| nonce: ObjectId, //this is used for protecting against concurrent edits: http://docs.mongodb.org/ecosystem/use-cases/metadata-and-asset-management/ | |
| name: String, | |
| dateCreated: { type: Date, default: Date.now }, | |
| dateLastChanged: { type: Date, default: Date.now }, | |
| postData: mongoose.Schema.Types.Mixed |
When the directory structure of your Node.js application (not library!) has some depth, you end up with a lot of annoying relative paths in your require calls like:
const Article = require('../../../../app/models/article');Those suck for maintenance and they're ugly.
| /* | |
| File: UIImage+ImageEffects.h | |
| Abstract: This is a category of UIImage that adds methods to apply blur and tint effects to an image. This is the code you’ll want to look out to find out how to use vImage to efficiently calculate a blur. | |
| Version: 1.0 | |
| Copyright (C) 2013 Apple Inc. All Rights Reserved. | |
| */ | |
| @import UIKit; |
So, I was developing a node shell script and wanted to determine the time it took from start, to finish to generate the output of a file. Simple, right? It is, but the problem is that if you want a clean way to do it... you have to develop it, otherwise you'll have a lot of wrapper code surrounding methods and such. So I wrote a small method to simplify it even further.
Benchmark Method:
function benchmark (method) {
var start = +(new Date);
method && method(function (callback) {
var end = +(new Date);| // Evento - v1.0.0 | |
| // by Erik Royall <[email protected]> (http://erikroyall.github.io) | |
| // Dual licensed under MIT and GPL | |
| // Array.prototype.indexOf shim | |
| // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/indexOf | |
| if (!Array.prototype.indexOf) { | |
| Array.prototype.indexOf = function (searchElement /*, fromIndex */ ) { | |
| 'use strict'; |
The trick? pass the file descriptor from a parent process and have the server.listen reuse that descriptor. So multiprocess in their own memory space (but with ENV shared usually)
It does not balance, it leaves it to the kernel.
In the last nodejs > 0.8 there is a cluster module (functional although marked experimental)
- http://nodejs.org/api/cluster.html
- Simple cluster example:
| #import <UIKit/UIKit.h> | |
| @interface UIView (Blur) | |
| +(UIImage*)createBlurredImageFromView:(UIView*)view; | |
| @end |
| CREATE TABLE cfurl_cache_blob_data( | |
| entry_ID INTEGER PRIMARY KEY, | |
| response_object BLOB, | |
| request_object BLOB, | |
| proto_props BLOB, | |
| user_info BLOB | |
| ); | |
| CREATE INDEX proto_props_index ON cfurl_cache_blob_data(entry_ID); | |
| CREATE TABLE cfurl_cache_receiver_data( |