Skip to content

Instantly share code, notes, and snippets.

View kapv89's full-sized avatar

kapil verma kapv89

  • Bangalore, India
  • 13:56 (UTC +05:30)
View GitHub Profile
<?php namespace div\Core;
use Illuminate\Container\Container;
use ReflectionFunction;
use Closure;
use div;
class Module extends Container {
protected static $scriptClosureMap = [];
<?php
use div\Std\App;
use div\Std\Http;
use div\Std\Jobs;
use Illuminate\Http\Request;
$app = new App('app', __DIR__.'/..', include 'config.php');
@kapv89
kapv89 / fpm
Last active August 29, 2015 13:57
Laravel 4(4.1.18) response times on hhvm and php5-fpm (php5.5.7) (i3 3rd gen, 4 gig laptop, on ubuntu 13.10). The request was made on an endpoint of an actual api that I am working on. It serves a lot of data, and has everything from authentication to eagerloading, serialization, logging etc, etc going on behind the scenes. Check out the last li…
req #1 : 150ms
req #2 : 130ms
req #3 : 152ms
req #4 : 111ms
req #5 : 119ms
req #6 : 116ms
req #7 : 124ms
req #8 : 125ms
req #9 : 135ms
req #10 : 120ms
@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 = {
http://vimeo.com/53221560
http://vimeo.com/53221558
http://vimeo.com/49718712
http://www.youtube.com/watch?v=f6kdp27TYZs
@kapv89
kapv89 / oop.js
Last active December 17, 2015 00:29
OOP in JS without "this" and "new" shit
//class definition + constructor
function FooFactory(bar, baz) {
/* return an object with a set of properties and functionalities
tied together using closuers and lexical scoping */
}
// actual object construction
var foo = FooFactory(bar, baz);
//inheritance (via as many object as you want)
@kapv89
kapv89 / compound.py
Last active December 17, 2015 00:49
a simple script to calculate the total amount accumulated over a span of years at a given interest rate and an yearly instalment
"""
for a given instalment, interest, and number of years, calculate the compounded amount.
USAGE:
python compound.py instalment interest, years
"""
import sys
@kapv89
kapv89 / gist:5656794
Last active December 17, 2015 18:59 — forked from whisher/gist:5656791
<?php
Route::get('/', function()
{
return View::make('home.index');
});
Route::controller('home');
@kapv89
kapv89 / gist:5684342
Last active December 17, 2015 22:48
Compile time error
public class Gen {
public static void main(String[] args) {
Foo<Integer> a = new Foo<Integer>(123);
// Baz b = new Baz("aha");
System.out.println(a.bar.toString());
// System.out.println(b.bar);
@kapv89
kapv89 / gist:5817622
Created June 19, 2013 20:11
a sample router
angular.module('sorter').config(function ($routeProvider, $locationProvider) {
// code fuplicated here, cos can't find a way to use custom service in config
var $uri = (function () {
var pageBase = '/admin/classification/sorter/app/', tmplBase = '/js/sorter/tmpls/',
apiBase = '/admin/classification/sorter/api/'
return {
page: function (uri) { return pageBase + uri; },
tmpl: function (uri) { return tmplBase + uri; },
api: function (uri) { return apiBase + uri; }