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 http = require('http'), | |
nodemailer = require('nodemailer'); | |
var smtpTransport = nodemailer.createTransport("SMTP",{ | |
service: "Gmail", | |
auth: { | |
user: "{user}", | |
pass: "{pass}" | |
} | |
}); |
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 crypto = require("crypto"), | |
urllib = require("url"); | |
/** | |
* Wrapper for new OAuthGenerator. | |
* | |
* Usage: | |
* | |
* var OAuthgen = createOAuthGenerator({}); | |
* OAuthgen.getToken(function(err, OAuthtoken){ |
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
UmVjZWl2ZWQ6IGZyb20gMTkyLjE2OC4wLjEyMCBieSBydS1ib2FyZC5jb20gZm9yIDxyYXp1aGFAbWFpbC5jb20+OyBNb24sIDI1IE1hciAyMDEzIDE2OjI4OjI4IC0wNTAwClJlY2VpdmVkOiAoZnJvbSBmb3J1bUBsb2NhbGhvc3QpCiAgICBieSBydS1ib2FyZC5jb20gKDguMTQuMi84LjE0LjIvU3VibWl0KSBpZCByMlBMU1BqdTAwMjE3MDsKICAgIE1vbiwgMjUgTWFyIDIwMTMgMTY6Mjg6MjUgLTA1MDAKRGF0ZTogTW9uLCAyNSBNYXIgMjAxMyAxNjoyODoyNSAtMDUwMApNZXNzYWdlLUlkOiA8MjAxMzAzMjUyMTI4LnIyUExTUGp1MDAyMTcwQHJ1LWJvYXJkLmNvbT4KVG86IHJhenVoYUBtYWlsLmNvbQpSZXBseS10bzogUnUtQm9hcmQgPGZvcnVtQG1haWwucnUtYm9hcmQuY29tPgpGcm9tOiBSdS1Cb2FyZCA8Zm9ydW1AbWFpbC5ydS1ib2FyZC5jb20+CkNvbnRlbnQtVHlwZTogdGV4dC9wbGFpbjsgY2hhcnNldD1XaW5kb3dzLTEyNTEKWC1NYWlsZXI6IFJVLkJvYXJkIG1haWxlciAoZm9yIGFueSBxdWVzdGlvbnMgY29udGFjdCB3aXRoIHN1cHBvcnQgdGVhbSkKU3ViamVjdDog0e/g8ejh7iDn4CDw5ePo8fLw4Pbo/iDiIMru7O/8/vLl8O376SD07vDz7CBSdS5Cb2FyZApYLUdyZXlsaXN0OiBTZW5kZXIgSVAgd2hpdGVsaXN0ZWQsIG5vdCBkZWxheWVkIGJ5IG1pbHRlci1ncmV5bGlzdC00LjAgKHJ1LWJvYXJkLmNvbSBbMTI3LjAuMC4xXSk7IE1vbiwgMjUgTWFyIDIwMTMgMTY6Mjg6MzIgLTA1MDAgKENEVCkKCgrK7uzv/P7y5fDt++kg9O7w8+wg |
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 inputName = "uploadedfile", | |
fileName = "test.txt", | |
fileContents = "hello world!", // UTF-8 | |
targetUrl = "http://example.com/post.php" | |
require("fetch").fetchUrl(targetUrl, { | |
method: "post", | |
agent: false, | |
headers:{ |
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
// npm install iconv iconv-lite | |
var Iconv = require("iconv").Iconv, | |
iconv = require("iconv-lite"); | |
var str = "abc&AOQA9gD8-"; | |
function convertFromUTF7_old(str){ | |
var fromUTF7 = new Iconv("UTF-16", "UTF-8//TRANSLIT//IGNORE") | |
// default string encoding by inbox is binary |
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
// GMAIL BUG: | |
// If a message has an message/rfc822 attachment then In-Reply-To value in the embedded envelope | |
// is forced to string even if the value was missing (the value is "NIL" instead of NIL) | |
// Usage: this is a node.js script, so you should have node installed (www.nodejs.org) | |
// replace USERNAME and PASSWORD values and run `node gmail-test.js` | |
// the output of this script is an IMAP log, see below for an example | |
// this script appends and removes a message with message/rfc822 attachments | |
var tls = require("tls"); |
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 dgram = require("dgram"); | |
var port = 18432, | |
multicastIP = "224.3.56.114"; | |
var client = dgram.createSocket('udp4'); | |
client.bind(port, "0.0.0.0"); | |
client.on("listening", function(){ | |
client.setBroadcast(true); |
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
// Install dependencies: | |
// npm install imap hoodiecrow | |
var Imap = require('imap'), | |
hoodiecrow = require("hoodiecrow"), | |
inspect = require('util').inspect; | |
var | |
// Message store for hoodiecrow |
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
<?php | |
$str = "/v1/combinedObjects:(id,user_id,value,title,person:(id,name,activities_count,owner_id:(name),activities_count),organization:(id,name))"; | |
print_r(queryParser($str)); | |
function queryParser($query){ | |
// split tokens | |
$tokens = preg_split('/,|(?=:\\(|\\))|(?<=:\\(|\\))/', $query, -1, PREG_SPLIT_NO_EMPTY); |
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
{ | |
"meta": { | |
"mail": true, | |
"message_id": "[email protected]", | |
"type": "Dropbox", | |
"date": "Fri, 27 Sep 2013 11:02:10 +0300", | |
"user_id": 25, | |
"company_id": 25 | |
}, | |
"data": { |