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 MailQueueService() | |
{ | |
public function getMailsFolder() | |
{ | |
return '/tmp/mails/'; | |
} | |
public function popSpooledMail() |
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
{ | |
"title": "Apples", | |
"tags": ["fruits"], | |
"id": "4ec92e34-34fb-47c1-a2b9-139866eb431a", | |
"_links": { | |
"self": {"href": "https://hateoas-notes.herokuapp.com/api/hal/notes/4ec92e34-34fb-47c1-a2b9-139866eb431a"}, | |
"up": {"href": "https://hateoas-notes.herokuapp.com/api/hal/notes"}, | |
"https://hateoas-notes.herokuapp.com/rels/owner": { | |
"href": "https://hateoas-notes.herokuapp.com/api/hal/users/61a4552c-d73e-4176-a912-adf404f5b6d1", | |
} |
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
{ | |
"_links" : { | |
"self" : {"href" : "/kids/123"}, | |
"teacher" : {"href" : "/teachers/999"}, | |
"possible-teacher": {"href" : "/kids/123/possible-teachers"} | |
}, | |
"name" : "Johnny", | |
"mom_phone" : "5554443333" | |
} |
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 a(b, c, callback) { | |
mysql_query("insert into magic_table pseudocode query (...)", function(status, data) { | |
if (status) { | |
callback(false, "Cannot add item!"); | |
return ; | |
} | |
// do custom code | |
callback(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
<?php | |
protected $module_folders = null; | |
/** | |
* Extended initializeModule for Agavi, allowing multiple modules-folders. * | |
*/ | |
public function initializeModule($moduleName) | |
{ | |
$lowerModuleName = strtolower($moduleName); | |
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
/* | |
* NodeJS Test Case for the blog post: | |
* "What's faster: JSON.parse+stringify or extend/mixin?" | |
* http://dracoblue.net/dev/whats-faster-jsonparsestringify-or-extendmixin/166/ | |
*/ | |
extend = process.mixin; | |
extend(true, {}, {}) | |
var sys = require("sys"); |
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
fs.readFile(this.files[uri], "binary", function(err, content) { | |
if (err) { | |
res.sendHeader(404, { | |
}); | |
} else { | |
res.sendHeader(200, { | |
"Content-Type": mime_type, | |
"Cache-Control": "public, max-age=300" | |
}); | |
res.write(content, "binary"); |
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
res.writeHead(200, { | |
"Content-Type": mime_type, | |
"Cache-Control": "public, max-age=300", | |
'Content-Length': content.length | |
}); | |
// a) works in 0.1.94: | |
var content_length = content.length; | |
var i = 0; | |
while (i<content_length) { |
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
// picard_sample/app.js | |
require('./config/env') | |
get('/', function(){ | |
return { text: '<h1>Hello to TestApp!</h1>' } | |
}) |
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
// express_sample.js | |
// Launched with this command: | |
// $ EXPRESS_ENV="production" node express_sample.js | |
var app = require('express').createServer(); | |
app.get('/', function(req, res){ | |
res.send('<h1>Welcome To Testapp</h1>'); | |
}); | |
app.listen(8080); |
OlderNewer