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
// don't do this | |
$(document).ready(function () { | |
$.get('/foo', function (response) { | |
var list = $('<ul />') | |
response.list.forEach(function (item) { | |
list.append($('<li />').text(item)) | |
}) | |
$('#content').append(list) |
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
const steps = { | |
stepBind(req, foo) { | |
// bla | |
}, | |
stepNoBind: (req) => (foo) => { | |
// bla |
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 map = require('./map'); | |
new map['Test'](); | |
// "hello from Test contructor" |
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 q = require('q'); | |
function subtract2(data) { | |
return data - 2; | |
} | |
function multiply5(data) { | |
return data * 5; | |
} |
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 q = require('q'), | |
assert = require('chai').assert, | |
sinon = require('sinon'); | |
var obj = { | |
load: function () { | |
console.log('-- `load` called with: %s', JSON.stringify(arguments)); | |
var defer = q.defer(); | |
setTimeout(function () { |
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 EventEmitter = require('events').EventEmitter; | |
var obj1 = new EventEmitter(); | |
obj1.on('event1', function () { | |
console.log('event1 triggered'); | |
}); | |
for (var i = 0; i < 3; ++i) { |
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 net = require('net'); | |
var server = net.Server(); | |
var port = process.env.PORT || 1337; | |
server.listen(port); | |
server.on('connection', function (socket) { | |
socket.write('hello'); | |
}); |
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 Readable = require('stream').Readable; | |
var rs = new Readable; | |
rs.push('bro '); | |
rs.push(null); | |
for (var i = 0; i < 10000; i++) | |
rs.pipe(process.stdout); |
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
<!doctype html> | |
<html lang="en"> | |
<head> | |
<meta charset="utf-8"> | |
<title>title</title> | |
<link rel="stylesheet" href="style.css"> | |
<script src="script.js"></script> | |
</head> |
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
# Include your user in www-data group | |
# This command needs to be run only once | |
useradd -G www-data brunops | |
# File User/Group owners | |
sudo chown -R brunops:www-data /path/to/folder --preserve-root | |
# Drupal file permissions | |
# Execution perm for files | |
sudo find /path/to/folder -type f -print0 | xargs -0 sudo chmod 644 --preserve-root |
NewerOlder