know the difference between shared and instance specific member variables in javascript.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var assert = require('assert'); | |
var buf, buf2; | |
buf = new Buffer([0x00, 0x41, 0x7f]); | |
buf2 = new Buffer(buf.toString()); | |
//console.log(buf, buf2); | |
// -> <Buffer 00 41 7f> <Buffer 00 41 7f> | |
assert(buf2.equals(buf), 'buffer with normal acii chars can be converted to string and back'); | |
assert.equal(buf2.length, 3); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$filePath = "test.txt" | |
# write append to file | |
echo 'halloo' >> $filePath | |
# write empty file | |
echo $null > $filePath |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# email-subscribers.dat is a file with email adresses separated by newline | |
# SmtpServer must be provided | |
$emails = Get-Content email-subscribers.dat | |
foreach($email in $emails) { | |
Send-MailMessage -From "me@you.com" -To $email -Subject "howzit" -Body "long time no see" -SmtpServer "smtp.google.com" | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// patch: "path-to-regexp": "git://github.com/pillarjs/path-to-regexp.git#asterisk-match" | |
var patch = require('./patch/node_modules/path-to-regexp'); | |
// old: "path-to-regexp": "^0.1.3" | |
var old = require('./0.1.3/node_modules/path-to-regexp'); | |
var assert = require('assert'); | |
// routes: 0: route, 1: path, 2: param | |
var routes = [ | |
['*', '/test/route/aA/bB/cC', '/test/route/aA/bB/cC'], |
modules in node are great. sharing them in npm is even better.
- make sure you understand, that module when you
require
the same module from within the same directory, you get the reference to the same thing. - if you
require
the same module in files wich are located in different directories, you get two new module instances.
node b.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sudo apt-get update # Fetches the list of available updates | |
sudo apt-get upgrade # Strictly upgrades the current packages | |
sudo apt-get dist-upgrade # Installs updates (new ones) |