Skip to content

Instantly share code, notes, and snippets.

View futur's full-sized avatar
🏠
Working from home

Futur futur

🏠
Working from home
View GitHub Profile

Getting Started with NPM (as a developer)

If you haven't already set your NPM author info, now you should:

npm set init.author.name "Your Name"
npm set init.author.email "[email protected]"
npm set init.author.url "http://yourblog.com"

npm adduser

@futur
futur / http_codes.js
Created July 22, 2013 09:51
HTTP status codes taken from NodejS git repo.
var STATUS_CODES = exports.STATUS_CODES = {
100 : 'Continue',
101 : 'Switching Protocols',
102 : 'Processing', // RFC 2518, obsoleted by RFC 4918
200 : 'OK',
201 : 'Created',
202 : 'Accepted',
203 : 'Non-Authoritative Information',
204 : 'No Content',
205 : 'Reset Content',
@futur
futur / fun_1.js
Last active May 22, 2021 02:34
Understanding identifiers (valid and invalid) in JS. Simple examples.
var $ = {'4s':'4 times S', s4:'s times 4'}; // correct identifiers and valid.
// var _ = {4s:'4 times S', s4:'s times 4'}; // Error in 4s, as its not a valid identifier. coz identifiers cant start with numbers. so add quotes.
console.log($['4s']); // 4 times S - this works because 4s is basically invalid identifier and thus we enclosed with quotes to make it work
// console.log($.4s); //Error since the 4s is not a valid identifier anc . operator will ignore with error.
console.log($.s4); //s times 4
var object ={.12e34 : 'hey'}
console.log(object['.12e34']); //undefined
console.log(object[.12e34]); //hey
@futur
futur / output.log
Created June 15, 2012 17:42
curl node repl (possibly dangerous?)
josh@onix:/tmp/http-repl$ curl -sSNT. localhost:8000
Actual repl over http. NOW WITH A LIMITED CONTEXT!!
>> help
'Exits are North, South and Dennis.'
>> .exit
Terminal exiting.
You'll want to mash ctrl-c.
^C
josh@onix:/tmp/http-repl$