Skip to content

Instantly share code, notes, and snippets.

😨
https://github.com/fractaltech ... most work here

kapil verma kapv89

😨
https://github.com/fractaltech ... most work here
Block or report user

Report or block kapv89

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@kapv89
kapv89 / uniques.js
Created Jul 7, 2018
Perf test on various methods to extract unique elements out of an array of objects
View uniques.js
const {range, shuffle} = require('lodash');
const f = require('faker');
let dup = (a) => a.map((el) => JSON.parse(JSON.stringify(el)));
console.time('seed');
let a = range(0, 20000).map(() => ({
id: f.random.uuid(),
name: f.name.findName(),
about: f.lorem.paragraphs(1),
@kapv89
kapv89 / vimrc
Last active Jun 16, 2019
my latest vimrc
View vimrc
syntax on
set backupdir=.backup/,~/.backup/,/tmp//
set directory=.swp/,~/.swp/,/tmp//
set undodir=.undo/,~/.undo/,/tmp//
set nocompatible " be iMproved, required
filetype off " required
" set the runtime path to include Vundle and initialize
set rtp+=~/.vim/bundle/Vundle.vim
@kapv89
kapv89 / fpm
Last active Aug 29, 2015
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…
View fpm
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
View app.php
<?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');
View module.php
<?php namespace div\Core;
use Illuminate\Container\Container;
use ReflectionFunction;
use Closure;
use div;
class Module extends Container {
protected static $scriptClosureMap = [];
View test.js
/// router
define(
['backbone'],
function (backbone) {
var router = new backbone.Router;
return {
route: function (uri, name, handler) {
router.route(uri, name, handler);
},
@kapv89
kapv89 / example.php
Last active Jan 2, 2016
reposed example
View example.php
<?php
class Boxes extends k\Reposed\Repository
{
protected function leftJoinOrdersPivot()
{
return $this->newJoint(function ($q) {
$pivot = Order::repo()->orderedBoxes()->getTable();
$q->leftJoin(
$pivot,
@kapv89
kapv89 / session.js
Created Oct 15, 2013
A simple session implementation for angular apps
View session.js
define(function () {
return [function () {
var keyName = API_KEY_NAME;
var key = localStorage.getItem('sessionKey');
return {
keyName: function () {
return keyName;
},
@kapv89
kapv89 / ajax.js
Created Oct 15, 2013
a jquery.ajax based replacement for angular http layer
View ajax.js
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 / api.dev
Created Sep 29, 2013
nginx api conf
View api.dev
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;
You can’t perform that action at this time.