Logging the contents of a file, and printing some random stuff:
JS (in node):
var fs = require('fs');
fs.readFile('/foo.txt', function(contents) {
console.log(contents);
});
<?php | |
trait Methods | |
{ | |
public function __call($name, $args) | |
{ | |
if (property_exists($this, $name)) { | |
return $this->$name; | |
} |
<?php | |
namespace AC\Fixtures; | |
/** | |
* Factories use Definitions and Pools to create and store (not persist) object instances. | |
*/ | |
interface Factory | |
{ | |
public function define($name); //create and returns Definition |
var logSomething = function(something) { | |
console.log(something); | |
}; | |
function do_math(foo, bar, baz) { | |
return foo + bar + baz; | |
}; | |
function do_math_then(foo, bar, baz) { |
Logging the contents of a file, and printing some random stuff:
JS (in node):
var fs = require('fs');
fs.readFile('/foo.txt', function(contents) {
console.log(contents);
});
setTimeout(function() { | |
console.log("2 seconds"); | |
}, 2000); | |
setTimeout(function() { | |
console.log("now??"); | |
}, 0); | |
console.log("now"); |
<?php | |
namespace AC\Fixtures; | |
/** | |
* Factories use Definitions and Pools to create and store (not persist) object instances. | |
*/ | |
interface Factory | |
{ | |
public function define($name); //create and returns Definition |
<?php | |
namespace AC\Authentication; | |
use Symfony\Component\HttpFoundation\Request; | |
use Symfony\Component\HttpFoundation\RequestMatcherInterface; | |
use Symfony\Component\HttpFoundation\Response; | |
use Symfony\Component\EventDispatcher\EventDispatcherInterface; |
gulp.task('build:bundles', function() { | |
var promises = []; | |
glob.sync('bundles/*/*/').forEach(function(dir) { | |
promises.push(cubeBuildBundle(dir, 'build/'+dir)); | |
}); | |
return Q.all(promises); | |
}); | |
gulp.task('build:apps:dev', ['build:bundles'], function() { | |
var promises = []; |
This describes a provider/service for wrapping the AngularStrap $modal
service. It allows for somewhat easier programatic usage.
First, you define a modal using the provider. Modals are named, and have default configuration for the underlying $modal
service:
angular.module('app', ['app.modals']).config (modalsProvider) ->
#empty validator | |
validator = new Validator() | |
#custom app validator | |
validator.constraint 'unique-name', (val, ops = {}) -> | |
namelist = [] #... array of names in system | |
return "Name already exists!" if namelist.indexOf val > -1 | |
return true | |
#another custom validator |