This is a fairly common question, and there isn't a One True Answer.
These are the most common techniques:
You need a client-side dependency management and build system. What I mean by this is:
A client-side script loader that does dependency management and can package your scripts for rapid download.
There are only 2 that I'm aware of that qualify are RequireJS and StealJS. There are 3 reason to use these systems:
This uses Twitter Bootstrap classes for CodeIgniter pagination.
Drop this file into application/config
.
<?php | |
class BaseModel extends Eloquent { | |
public static function shouldReceive() | |
{ | |
$repo = get_called_class() . 'RepositoryInterface'; | |
$mock = Mockery::mock($repo); | |
App::instance($repo, $mock); |
// needs underscore and Backbone.Events( really didn't want to code that stuff up :P) | |
window.sandBoxFactory = function () { | |
var vent = _.extend({}, Backbone.Events); // The event aggregator for the sandbox | |
var communicatorEvents = []; | |
var broadCasters = {}; | |
var sandBox = { |
We are gonna be using php5.5 , so upgrade your systems to that.
http://laravel.com/docs/contributing#coding-guidelines , we follow these, along with PSR-0 and PSR-1.
use Foo
(aliasing) etc statements should start from the 3rd line. Each class that needs to be used in a namespace has to be aliased in a separate line.
Aliasing is important. You shouldn't be using more than two Namespace Separators (\)
in the code that you right in your classes. Try to restrict the count of those namespace separators to one.
No accessing global namespace (ie, \Foo
is not allowed, you need to alias the class Foo
via use Foo
). The only exception for this is php spl exception classes.
if ($request_method = 'OPTIONS') { | |
add_header 'Access-Control-Allow-Origin' $http_origin; | |
add_header 'Access-Control-Allow-Credentials' 'true'; | |
add_header 'Access-Control-Allow-Methods' 'GET, POST, PUT, DELETE, OPTIONS'; | |
add_header 'Access-Control-Allow-Headers' 'DNT,X-Mx-ReqToken,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,$cors_headers'; | |
add_header 'Access-Control-Expose-Headers' $cors_headers; | |
# dafuq are these | |
add_header 'Access-Control-Max-Age' 1728000; | |
add_header 'Content-Type' 'text/plain charset=UTF-8'; |
server { | |
server_name api.foo.dev; | |
listen 80; | |
access_log /var/log/nginx/api.foo.dev.access.log; | |
error_log /var/log/nginx/api.foo.dev.error.log; | |
root /home/user/Projects/foo/server/api/public; |
define(function () { | |
return [ | |
'$rootScope', '$q', 'session', | |
function ($rootScope, $q, session) { | |
var ajax = function (options) { | |
var deferred = $q.defer(); | |
var success = function (data, status, xhr) { |
define(function () { | |
return [function () { | |
var keyName = API_KEY_NAME; | |
var key = localStorage.getItem('sessionKey'); | |
return { | |
keyName: function () { | |
return keyName; | |
}, |