This file contains hidden or 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
# a better nginx config | |
02 | |
# author @dnoiz1 | |
03 | |
04 | |
server { | |
05 | |
root /var/www/mysite.tld/; | |
06 |
This file contains hidden or 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
hexdump sqldump.sql | head | |
0000000 6157 6e72 6e69 3a67 5420 6568 6f20 7470 | |
0000010 6f69 206e 2d27 612d 6c6c 2027 7369 6420 | |
0000020 7065 6572 6163 6574 2064 6e61 2064 6977 | |
0000030 6c6c 6220 2065 6572 6f6d 6576 2064 6e69 | |
0000040 6120 6620 7475 7275 2065 6572 656c 7361 | |
0000050 2e65 5020 656c 7361 2065 7375 2065 2d2d | |
0000060 7263 6165 6574 6f2d 7470 6f69 736e 6920 | |
0000070 736e 6574 6461 0a2e 2d2d 4d20 5379 4c51 | |
0000080 6420 6d75 2070 3031 312e 2033 4420 7369 |
This file contains hidden or 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
// uninstalling global packages(express in this example): | |
npm uninstall [pkg] -g | |
//view info about a certain package: | |
npm view [pkg] | |
//check globally installed npm modules | |
npm -g ls |
This file contains hidden or 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
//first, require nib in the beginning of the file. note that requiring stylus was needed due to the second code change below: | |
, nib = require('nib') | |
, stylus = require('stylus'); | |
//second change: | |
app.use(stylus.middleware({ src: __dirname + '/public', | |
compile: compile | |
})); | |
//third change, added the function compile: |
This file contains hidden or 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
///////////////// | |
// Semantic.gs // for Stylus: http://learnboost.github.com/stylus/ | |
///////////////// | |
// Defaults which you can freely override | |
column-width = 60px | |
gutter-width = 20px | |
columns = 12 | |
// Utility variable — you should never need to modify this |
This file contains hidden or 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
if i have this: | |
body { | |
font: 14px/1.5 Helvetica, arial, sans-serif; | |
#logo { | |
border-radius: 5px; | |
} | |
} | |
would be the same as |
This file contains hidden or 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
body { | |
width: 100%; | |
clearfix(); | |
} |
This file contains hidden or 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
npm install stylus -g | |
than after issue the following command: | |
stylus -w && nodemon app.js | |
http://learnboost.github.com/stylus/docs/executable.html |
This file contains hidden or 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
Add app.enable('trust proxy') as I have express running behind nginx: | |
------------------------------------------------------------------------------------------------------------ | |
Express behind proxies | |
Using Express behind a reverse proxy such as Varnish or Nginx is trivial, however it does require configuration. By enabling the "trust proxy" setting via app.enable('trust proxy'), Express will have knowledge that it's sitting behind a proxy and that the X-Forwarded-* header fields may be trusted, which otherwise may be easily spoofed. | |
Enabling this setting has several subtle effects. The first of which is that X-Forwarded-Proto may be set by the reverse proxy to tell the app that it is https or simply http. This value is reflected by req.protocol. | |
The second change this makes is the req.ip and req.ips values will be populated with X-Forwarded-For's list of addresses. | |
http://expressjs.com/guide.html |
This file contains hidden or 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 cashRegister = { | |
total:0, | |
add: function(itemCost){ | |
this.total += itemCost; | |
}, | |
scan: function(item, quantity) { | |
switch (item) { | |
case "eggs": this.add(0.98 * quantity); break; | |
case "milk": this.add(1.23 * quantity); break; | |
case "magazine": this.add(4.99 * quantity); break; |