- Who are you?
- What is Laravel?
- Why create another framework?
- What frameworks/methodologies have been instrumental in shaping Laravel?
| myfunc = (num) -> | |
| if num is 1 | |
| return "num is 1"; | |
| else | |
| return "not 1"; |
| class ArrayIterator extends \ArrayIterator | |
| { | |
| protected $_previous; | |
| public function next() | |
| { | |
| $this->_previous = $this->key(); | |
| parent::next(); | |
| } |
| function create($name, $parameters = []) | |
| { | |
| $name = str_replace(".", "\\", $name); | |
| $reflection = new ReflectionClass($name); | |
| return $reflection->newInstanceArgs($parameters); | |
| } | |
| create("Some.Namespaced.Class", [$arg1, $arg2]); # -> new Some\Namespaced\Class($arg1, $arg2) |
| if (!function_exists("_path")) | |
| { | |
| function _path() | |
| { | |
| return dirname(__DIR__); | |
| } | |
| } | |
| if (!function_exists("_require")) | |
| { |
| <?php | |
| define('TYPEHINT_PCRE' ,'/^Argument (\d)+ passed to (?:(\w+)::)?(\w+)\(\) must be an instance of (\w+), (\w+) given/'); | |
| class Typehint | |
| { | |
| private static $Typehints = array( | |
| 'boolean' => 'is_bool', | |
| 'integer' => 'is_int', |
| /** | |
| * simple mustache-like templater | |
| * http://mir.aculo.us/2011/03/09/little-helpers-a-tweet-sized-javascript-templating-engine/ | |
| * ----------------------------------------------------------------------------------------- | |
| * t('Hello, {{planet}}!', {'planet': 'World'}); | |
| * returns 'Hello, World!'; | |
| */ | |
| function t(s,d){ | |
| for(var p in d) | |
| s=s.replace(new RegExp('{{'+p+'}}','g'), d[p]); |
| // I don't usually inline my javascript, but when I do it is in Greg's HTML. | |
| (function () { | |
| var last = 0, | |
| vendors = ["ms", "moz", "webkit", "o"]; | |
| for (var x = 0; x < vendors.length && !window.requestAnimationFrame; ++x) { | |
| window.requestAnimationFrame = window[vendors[x] + "RequestAnimationFrame"]; | |
| window.cancelAnimationFrame = window[vendors[x] + "CancelAnimationFrame"] || window[vendors[x] + "CancelRequestAnimationFrame"]; |
| <?php | |
| class Collection implements IteratorAggregate, ArrayAccess, Countable | |
| { | |
| // ... | |
| public function toJSON() | |
| { | |
| $return = array(); |
| $obj = new Generic([ | |
| "var1" => "foo", | |
| "var2" => "bar", | |
| "func1" => function() | |
| { | |
| echo $this->var1; | |
| }, |