Note: this rough draft has turned into https://github.com/maxogden/art-of-node#art-of-node
go to https://github.com/maxogden/art-of-node#art-of-node to view the newer versions of this document
pr () { | |
git fetch origin refs/pull/$1/head:refs/remotes/origin/pr/$1 --force | |
git checkout -b pr/$1 origin/pr/$1 | |
git rebase master | |
git checkout master | |
git merge pr/$1 --ff-only | |
} |
go to https://github.com/maxogden/art-of-node#art-of-node to view the newer versions of this document
Headless testing
Frameworks, Librerias y Herramientas
var $ = require('cheerio'), | |
_ = require('underscore'), | |
request = require('request'), | |
// If you want to create a file | |
images = [], | |
path = require('path'), | |
dir = path.join(__dirname,'\Templates'), | |
fs = require('fs'), | |
GetImage = function(file){ | |
var HtmlFile = fs.readFileSync(file).toString(), |
var mongoose = require('mongoose'); | |
mongoose.connect('mongodb://localhost/app'); | |
var usrSchema = new mongoose.Schema({ | |
user: { type: String, required: true }, | |
password: { type: String, required: true }, | |
DLU: { type: Date } | |
}); | |
var bcrypt = require('bcrypt-nodejs'), | |
sqlite3 = require('sqlite3').verbose(); | |
var file = 'content/data/ghost-dev.db'; | |
var db = new sqlite3.Database(file); | |
var password = 'YOUR_NEW_PASSWD'; | |
bcrypt.hash(password, null, null, function(err, hash) { | |
db.serialize(function() { | |
db.run("UPDATE users SET password = ? WHERE id = ?", hash, 1); |
/** | |
* Module dependencies. | |
*/ | |
var pkg = require('../package'); | |
var env = process.env.NODE_ENV || 'development'; | |
/** | |
* Return setting `name`. | |
* |
'use strict'; | |
/*:: | |
type Client = Object; | |
type Channel = string; | |
*/ | |
const channels/*: Map<Channel, Set<Client>> */ = new Map; | |
const clients/*: Map<Client, Set<Channel>> */ = new WeakMap; | |
const join = (name, client) => { | |
if (!channels.has(name)) { |
Before starting, ensure you can ssh user@targetserver
successfully - public/private keys are a smart choice here.
targetserver
Example here assumes all Git repository users are members of a gitusers
group, adjust to suit.
module.exports = function (PassportUserCredential) { | |
/* | |
* Check if credentials already exist for a given provider and external id | |
* Enable this hook if credentials can be linked only once | |
* | |
* @param Loopback context object | |
* @param next middleware function | |
* */ | |
PassportUserCredential.observe('before save', function checkPassportUserCredentials(ctx, next){ |