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 postcss = require('postcss'); | |
module.exports = postcss.plugin('postcss-clean-var-backslash', function() { | |
return function (css) { | |
css.walkRules(function(rule) { | |
rule.selector = rule.selector.replace(/^\\--/, '--'); | |
}); | |
}; | |
}); |
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
/** | |
* Requires a library, but only loads it when it's actually used. | |
* | |
* lazy_require('fs'); | |
* fs.readFileSync('example.js'); | |
* | |
* var wow = lazy_require('fs'); | |
* wow.readFileSync('example.js'); | |
* | |
* @param {String} lib - name of the lib you want to load |
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 iptables -F # flush rules | |
sudo iptables -A INPUT -i eth0 -p tcp --dport 50000 -j ACCEPT # allow ssh | |
sudo iptables -A INPUT -i eth1 -j ACCEPT # allow everything on local network | |
sudo iptables -A INPUT -j DROP # drop everything else |
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 kue = require('kue'); | |
var jobs = kue.createQueue(); | |
console.log('Restarting job ' + process.argv[2]); | |
jobs.state(process.argv[2], function (err, ids) { | |
ids.forEach(reactivate); | |
}); | |
function reactivate (id) { |
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 iptables -F | |
sudo iptables -X | |
sudo iptables -I INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT | |
sudo iptables -A INPUT -p icmp -j ACCEPT # allow ping | |
sudo iptables -A INPUT -p tcp --dport 22 -j ACCEPT # allow SSH | |
sudo iptables -A INPUT -p tcp --dport 80 -j ACCEPT # allow HTTP | |
sudo iptables -I INPUT -i lo -j ACCEPT # allow local | |
sudo iptables -A INPUT -j DROP # drop everything else |
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 youtubeSearch = require('youtube-search'); | |
var keyword = 'Looney Tunes: De Volta à Ação filme trailer oficial'; | |
youtubeSearch.search(keyword, {maxResults: 1}, function (err, youtube) { | |
console.log(err); | |
console.log(youtube); | |
}); |
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
if (config.admin.email) { | |
process.on('uncaughtException', function(err) { | |
console.log(err.stack); | |
nodemailer.createTransport("SMTP", { | |
service: "Sendgrid" | |
, auth: { | |
user: config.smtp.username | |
, pass: config.smtp.password | |
} | |
}).sendMail({ |
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
[ | |
{ "name": "Acre", "code": "AC", "capital": "Rio Branco" }, | |
{ "name": "Alagoas", "code": "AL", "capital": "Maceió" }, | |
{ "name": "Amazonas", "code": "AM", "capital": "Manaus" }, | |
{ "name": "Amapá", "code": "AP", "capital": "Macapá" }, | |
{ "name": "Bahia", "code": "BA", "capital": "Salvador" }, | |
{ "name": "Ceará", "code": "CE", "capital": "Fortaleza" }, | |
{ "name": "Distrito Federal", "code": "DF", "capital": "Brasília" }, | |
{ "name": "Espírito Santo", "code": "ES", "capital": "Vitória" }, | |
{ "name": "Goiás", "code": "GO", "capital": "Goiânia" }, |
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
REPORTER = spec | |
check: test | |
test: test-unit | |
test-unit: | |
@NODE_ENV=test mocha \ | |
--reporter $(REPORTER) \ | |
test/configure.js test/models/*.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
# Replace your PS1, inside ~/.bashrc for this: | |
# source ~/.bashrc_git | |
# PS1='\w\[\033[0;32m\]$(parse_git_branch_or_tag)\[\033[00m\]: ' | |
parse_git_branch () { | |
git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/ (\1)/' | |
} | |
parse_git_tag () { | |
git describe --tags 2> /dev/null |
NewerOlder