Skip to content

Instantly share code, notes, and snippets.

View ilmsg's full-sized avatar
😍
love me love my bug

Eak Netpanya ilmsg

😍
love me love my bug
View GitHub Profile
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:
@ilmsg
ilmsg / app.js
Created June 13, 2013 04:45 — forked from dbainbridge/app.js
/**
* Module dependencies.
*/
var express = require('express')
, routes = require('./routes')
, http = require('http');
var app = express();
var server = app.listen(3000);
@ilmsg
ilmsg / app.js
Created June 13, 2013 04:45 — forked from dbainbridge/app.js
/**
* Module dependencies.
*/
var express = require('express')
, routes = require('./routes')
, http = require('http');
var app = express();
var server = app.listen(3000);
@ilmsg
ilmsg / app.js
Created June 13, 2013 06:24 — forked from dbainbridge/app.js
/**
* Module dependencies.
*/
var express = require('express')
, routes = require('./routes')
, http = require('http');
var app = express();
var server = app.listen(3000);

How to use Codeception on CodeIgniter 2.1.x

Using Codeception Test with CodeIgniter

Requirements

  • PHP >= 5.3
  • PHP CURL extension enabled
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() {
@ilmsg
ilmsg / api.js
Created July 6, 2013 21:30 — forked from fwielstra/api.js
/* 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');
@ilmsg
ilmsg / app.js
Created July 9, 2013 07:05 — forked from bobbydavid/app.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();