Skip to content

Instantly share code, notes, and snippets.

View kapv89's full-sized avatar

kapil verma kapv89

  • Bangalore, India
  • 16:14 (UTC +05:30)
View GitHub Profile
@kapv89
kapv89 / myserver.conf
Created August 24, 2021 18:50 — forked from canadaduane/myserver.conf
nginx configuration for yjs over https reverse proxy
server {
listen 80 ;
# listen [::]:80 ipv6only=on;
root /var/www/html;
index index.php index.html index.htm;
server_name y.relm.us;
location / {
@kapv89
kapv89 / uniques.js
Created July 7, 2018 16:01
Perf test on various methods to extract unique elements out of an array of objects
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 December 1, 2019 06:52
my latest 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 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
<?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');
<?php namespace div\Core;
use Illuminate\Container\Container;
use ReflectionFunction;
use Closure;
use div;
class Module extends Container {
protected static $scriptClosureMap = [];
@kapv89
kapv89 / test.js
Last active January 2, 2016 08:39
/// 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 January 2, 2016 05:59
reposed example
<?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 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;
},