Skip to content

Instantly share code, notes, and snippets.

View adityamenon's full-sized avatar

Aditya MP adityamenon

View GitHub Profile
@canton7
canton7 / 0main.md
Last active November 7, 2023 08:16
Local versions of tracked config files

How to have local versions of tracked config files in git

This is a fairly common question, and there isn't a One True Answer.

These are the most common techniques:

If you can modify your application

@justinbmeyer
justinbmeyer / gist:1601981
Created January 12, 2012 17:39
You need a client-side dependency management and build system.

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:

  • Easy, Parallel, Isolated Development
  • Integrated Build Systems
  • They work on every system
@mikedfunk
mikedfunk / README.md
Created August 28, 2012 21:17
CodeIgniter Pagination for Twitter Bootstrap

This uses Twitter Bootstrap classes for CodeIgniter pagination.

Drop this file into application/config.

@JeffreyWay
JeffreyWay / BaseModel.php
Last active March 1, 2020 07:14
To make for clean and readable tests, do your mocking in a base model that your Eloquent models extend.
<?php
class BaseModel extends Eloquent {
public static function shouldReceive()
{
$repo = get_called_class() . 'RepositoryInterface';
$mock = Mockery::mock($repo);
App::instance($repo, $mock);
@kapv89
kapv89 / sandBox.js
Last active December 13, 2015 20:18
An untested concept of a sandbox for client side dev
// 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.

  1. http://laravel.com/docs/contributing#coding-guidelines , we follow these, along with PSR-0 and PSR-1.

  2. 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.

  3. 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.

  4. 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.

@kapv89
kapv89 / cors-nginx.conf
Created September 29, 2013 15:08
cors-nginx
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';
@kapv89
kapv89 / api.dev
Created September 29, 2013 15:18
nginx api conf
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;
@kapv89
kapv89 / ajax.js
Created October 15, 2013 22:10
a jquery.ajax based replacement for angular http layer
define(function () {
return [
'$rootScope', '$q', 'session',
function ($rootScope, $q, session) {
var ajax = function (options) {
var deferred = $q.defer();
var success = function (data, status, xhr) {
@kapv89
kapv89 / session.js
Created October 15, 2013 22:11
A simple session implementation for angular apps
define(function () {
return [function () {
var keyName = API_KEY_NAME;
var key = localStorage.getItem('sessionKey');
return {
keyName: function () {
return keyName;
},