Using Codeception Test with CodeIgniter
- PHP >= 5.3
- PHP CURL extension enabled
| the basics of programming with callbacks: | |
| structure: | |
| function simple1(cb) // the last argument is callback function | |
| { | |
| if(cb)return cb();// the return is required to prevent continuation of the function | |
| } | |
| to make a function asynchronous: add cb as last argument. | |
| put at the end: if(cb)return cb(); |
| <?php | |
| /* | |
| * | |
| * Uploaded by Rajah Oshimin | |
| * Udated from : http://cloudsherpaz.wordpress.com/2013/01/05/migrate-mysql-database-to-mongodb/ | |
| * | |
| */ | |
| // genghis is a single-file MongoDB admin application. | |
| // Located at http://genghisapp.com/ |
| the basics of programming with callbacks: | |
| structure: | |
| function simple1(cb) // the last argument is callback function | |
| { | |
| if(cb)return cb();// the return is required to prevent continuation of the function. | |
| // the if(cb) is optional and it is to enable to omit the callback in rare cases. it is usually useful in api functions. | |
| } | |
| to make a function asynchronous capbl;e: |
| /** | |
| * Module dependencies. | |
| */ | |
| var express = require('express') | |
| , routes = require('./routes') | |
| , http = require('http'); | |
| var app = express(); | |
| var server = app.listen(3000); |
| /** | |
| * Module dependencies. | |
| */ | |
| var express = require('express') | |
| , routes = require('./routes') | |
| , http = require('http'); | |
| var app = express(); | |
| var server = app.listen(3000); |
| /** | |
| * Module dependencies. | |
| */ | |
| var express = require('express') | |
| , routes = require('./routes') | |
| , http = require('http'); | |
| var app = express(); | |
| var server = app.listen(3000); |
| javascript: (function () { | |
| function c() { | |
| var e = document.createElement("link"); | |
| e.setAttribute("type", "text/css"); | |
| e.setAttribute("rel", "stylesheet"); | |
| e.setAttribute("href", f); | |
| e.setAttribute("class", l); | |
| document.body.appendChild(e) | |
| } | |
| function h() { |
| /* The API controller | |
| Exports 3 methods: | |
| * post - Creates a new thread | |
| * list - Returns a list of threads | |
| * show - Displays a thread and its posts | |
| */ | |
| var Thread = require('../models/thread.js'); | |
| var Post = require('../models/post.js'); |
| var express = require('express') | |
| , http = require('http') | |
| , connect = require('connect') | |
| , io = require('socket.io'); | |
| var app = express(); | |
| /* NOTE: We'll need to refer to the sessionStore container later. To | |
| * accomplish this, we'll create our own and pass it to Express | |
| * rather than letting it create its own. */ | |
| var sessionStore = new connect.session.MemoryStore(); |