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
/* SomeClass.js */ | |
Class("SomeClass", { | |
use : ["jquery.js", "OtherClass"], | |
after : { | |
initialize : function() { | |
var thisInstance = this; | |
use("jquery.js", function() { | |
console.log("Jquery should be loaded here: %o", jQuery); |
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
//TreeNode data structure | |
Class("DOM.Tree.Node", { | |
has : { | |
attributes : {is : "rw", required: true}, //array with DOM.Attributes, excludes stype attribute | |
styleArr : {is : "rw", required: true}, //style array of the node (attributes with name and value) | |
name : {is : "rw", required: true}, //name of the node | |
type : {is : "rw", required: true} //type of the node | |
} | |
}); |
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 attributes = []; | |
if (node.attributes) { | |
for (var i = 0, iMax = node.attributes.length; i < iMax; i++) { | |
//set name | |
var name = node.attributes[i].name; | |
//validate name | |
if (typeof(name) != "string") throw "newTreeNode attr name is not a string."; | |
//exclude style |
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
package com.tommedema.testapp; | |
import java.util.ArrayList; | |
import android.app.Service; | |
import android.content.Intent; | |
import android.media.AudioFormat; | |
import android.media.AudioManager; | |
import android.media.AudioRecord; | |
import android.media.AudioTrack; |
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
{ | |
"num_mf_results" : "1", | |
"num_all_results" : "", | |
"original_query" : "((exchange:AMEX) OR (exchange:NYSE) OR (exchange:NASDAQ))", | |
"query_for_display" : "((exchange:AMEX) OR (exchange:NYSE) OR (exchange:NASDAQ))", | |
"results_type" : "COMPANY", | |
"searchresults" : | |
[ | |
{ | |
"title" : "Exxon Mobil Corporation", |
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
//fired when request has been answered | |
httpRequest.on('response', function (response) { | |
//set encoding | |
response.setEncoding('utf8'); | |
//setup output stream | |
var filePath = 'someFile.csv'; | |
console.log('Now writing: ' + filePath); | |
var writeStream = fs.createWriteStream(filePath, { | |
'flags': 'w+', |
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
module.exports = function(server, everyone) { | |
var util = require('util'); | |
var formidable = require('formidable'); | |
server.post('/upload', function(req, res) { | |
util.log('/upload request, content type: ' + req.headers['content-type']); | |
//headers look like eg. 'multipart/form-data; boundary=----pluploadboundaryp15svdal5r1c4ni4610kk1tssa8d4' | |
var form = new formidable.IncomingForm(); | |
form.keepExtensions = 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
//main.js | |
var util = require('util'); | |
util.debug('main initializing'); | |
var someMod = require('./someModule')('SomeApp', 'Tom'); | |
someMod.displayAppName(); | |
someMod.displayUserName(); |
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
//main.js | |
var util = require('util'); | |
util.debug('main initializing'); | |
var someMod = require('./someModule')('SomeApp', 'Tom'); | |
someMod.displayAppName(); | |
someMod.displayUserName(); |
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
//dependencies: | |
//node-formidable | |
//now.js | |
var formidable = require('formidable'), | |
http = require('http'), | |
sys = require('sys'), | |
util = require('util'), | |
nowjs = require('now'), | |
uploadCounter = 0, |