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
//namespace to avoid collitions between src | |
var AppSpace = {}; | |
AppSpace.createUUID = function() { | |
// http://www.ietf.org/rfc/rfc4122.txt | |
var s = []; | |
var hexDigits = "0123456789abcdef"; | |
for (var i = 0; i < 36; i++) { | |
s[i] = hexDigits.substr(Math.floor(Math.random() * 0x10), 1); | |
} |
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 express = require('express'); | |
//cli | |
var fs = require('fs'); | |
var stream = fs.createReadStream('my-file.txt'); | |
stream.on('data', function(chunk){ | |
// do something with part of the file | |
}); | |
stream.on('end', function(chunk){ |
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
<!DOCTYPE html> | |
<html> | |
<head> | |
<title>sample html</title> | |
<style type=""> | |
label( | |
display:inline-block; | |
width:150px; | |
) | |
</style> |
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 AWS = require('aws-sdk'); | |
var firehose = new AWS.Firehose(); | |
exports.handler = function(event, context) { | |
var params = { | |
DeliveryStreamName: <STRING>, | |
Record: { | |
Data: decodeURIComponent(event) | |
} | |
}; |
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 FicsClient = require("fics"); | |
var socket = (new FicsClient()).getStream(); | |
process.stdin.pipe(socket); | |
socket.pipe(process.stdout); | |
socket.on("close", process.exit); |
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
#!/bin/sh | |
########################## | |
# fetch_pres_log.sh - | |
# script to download the access_logs from | |
# the rPVR webserver. | |
########################## | |
# SSH Configuration Note | |
# ------------------------------------------------------------------- | |
# The host alias, username and SSH key identity file are all configured |
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
<!DOCTYPE html> | |
<html> | |
<head> | |
<title>AWS SDK for JavaScript - Sample Application</title> | |
<script src="https://sdk.amazonaws.com/js/aws-sdk-2.1.12.min.js"></script> | |
</head> | |
<body> | |
<input type="file" id="file-chooser" /> |
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 express = require('express') | |
var app = express() | |
app.get('/', function (req, res) { | |
res.send('Hello World!') | |
}) | |
var server = app.listen(3000, function () { | |
var host = server.address().address |
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
// primitives | |
var a = 5; | |
var b = a; | |
b = 6; | |
//a; // will be 5 | |
//b; // will be 6 | |
// complex | |
var a = ['hello', 'world']; | |
var b = a; |
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 CryptoJS = require("crypto-js"); | |
console.log(CryptoJS.HmacSHA1("Message", "Key")); | |
// Encrypt | |
var ciphertext = CryptoJS.AES.encrypt('my message', 'secret key 123'); | |
// Decrypt | |
var bytes = CryptoJS.AES.decrypt(ciphertext.toString(), 'secret key 123'); |