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 fs = require('fs'); | |
fs.readFile('testing.txt', {encoding:'utf8'}, function (err, data) { | |
if (err) throw err; | |
console.log('orig:\n' + data); | |
console.log('\n\n\nafter JSON.stringify:\n' + JSON.stringify(data)); | |
console.log('\n\n\nafter JSON.stringify escapeSpecialChars() :\n' + JSON.stringify(data).escapeSpecialChars()); | |
}); | |
String.prototype.escapeSpecialChars = function() { | |
return this.replace(/\\n/g, "\\n").replace(/\\'/g, "\\'").replace(/\\"/g, '\\"').replace(/\\&/g, "\\&").replace(/\\r/g, "\\r").replace(/\\t/g, "\\t").replace(/\\b/g, "\\b").replace(/\\f/g, "\\f"); |
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
<?php | |
class PassAPI extends Plugin | |
{ | |
# Registration | |
# register a device to receive push notifications for a pass | |
# | |
# POST /v1/devices/<deviceID>/registrations/<typeID>/<serial#> | |
# Header: Authorization: ApplePass <authenticationToken> | |
# JSON payload: { "pushToken" : <push token, which the server needs to send push notifications to this device> } | |
# |
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
zipstream = require "zipstream" | |
fs = require "fs" | |
async = require "async" | |
class StreamingResponse | |
filename: "" | |
files: [] | |
streaming: 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
#!/usr/bin/env node | |
require('fs').readFile('image.png',function(err, data){ | |
console.log(require('crypto').createHash('sha1').update(data).digest('hex')) | |
}) |
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 spawn = require('child_process').spawn, | |
aws2js = require('aws2js'), | |
http = require('http'), | |
urlutil = require('url') | |
mime = require('mime'), | |
Buffers = require('buffers'); | |
var settings = { | |
s3: { | |
key: 'key', |
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
/* | |
* Based on https://gist.github.com/583836 from http://stackoverflow.com/questions/3709391/node-js-base64-encode-a-downloaded-image-for-use-in-data-uri. | |
* Neither that gist nor this one work for me in 0.2.x or 0.3.x. | |
*/ | |
var request = require('request'), | |
BufferList = require('bufferlist').BufferList, | |
sys = require('sys'), | |
bl = new BufferList(), | |
url = 'http://nodejs.org/logo.png' | |
; |
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 ErrorLog = common.mongoose.model('ErrorLog', schema); | |
// differences of line 4 vs 5? | |
exports = module.exports = ErrorLog; | |
exports.ErrorLog = ErrorLog; |
A custom UI set built to work with and sit next to Bootstrap 3. Custom select boxes by @catalinred. 3D Scroll effects inspired by @chriscoyier's slide in when scroll down pen. The kit is also responsive!
Try clicking & hovering everything.
Feel free to fork, heart and share!
A Pen by Matt Litherland on CodePen.