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
function Foo1() { | |
} | |
Foo1.prototype.interact = function() { | |
this.dispose = true | |
} | |
class Foo2 { | |
interact() { | |
this.dispose = true |
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
dgram.js:147 | |
newHandle.lookup = self._handle.lookup; | |
^ | |
TypeError: Cannot set property 'lookup' of undefined | |
at replaceHandle (dgram.js:147:20) | |
at dgram.js:201:9 | |
at Object.10:8921 (cluster.js:592:5) | |
at handleResponse (cluster.js:171:41) | |
at respond (cluster.js:192:5) | |
at handleMessage (cluster.js:202: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 dgram = require('dgram') | |
var socket = dgram.createSocket('udp4') | |
socket.on('message', function(msg) { | |
console.log(msg.toString()) | |
}) | |
socket.bind(5514, '127.0.0.1') |
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
import 'dart:io'; | |
void main() { | |
RawDatagramSocket.bind('127.0.0.1', 5514, reuseAddress: true).then((value) { | |
value.listen((event) { | |
if (event == RawSocketEvent.READ) { | |
var datagram = value.receive(); | |
print(new String.fromCharCodes(datagram.data)); | |
} | |
}); |
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
use std::io::net::ip; | |
use std::io::net::udp; | |
use std::str; | |
fn main() { | |
let addr = ip::SocketAddr { | |
ip: ip::Ipv4Addr(127, 0, 0, 1), | |
port: 5514 | |
}; |
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
// ECMA 5 | |
var duplicates = ['taco', 'taco', 'bacon', 'pancake', 'cake', 'salt', 'cake'] | |
var set = {} | |
duplicates.forEach(function(value) { | |
set[value] = true | |
}) | |
console.log(Object.keys(set)) // Outputs an array with no duplicates |
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
// Random inheritance example | |
function Vehicle(color) { | |
this.color = color | |
} | |
Vehicle.prototype.move = function() { | |
// Do some stuff here | |
} |
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 filereadable("package.json") | |
autocmd BufWritePost <buffer> !npm test | |
endif |
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> | |
<head> | |
<title>Undefined Test</title> | |
<meta charset='utf-8' /> | |
</head> | |
<body> | |
<script> | |
if (undefined instanceof Object) { | |
alert('undefined is an Object') |
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
#!/bin/bash | |
# nodejs - Startup script for node.js server | |
# chkconfig: 35 85 15 | |
# description: node is an event-based web server. | |
# processname: node | |
# server: /path/to/your/node/file.js | |
# pidfile: /var/run/nodejs.pid | |
# |