Skip to content

Instantly share code, notes, and snippets.

@rkalkani
rkalkani / gist:23b5eed7e610ac414296
Created February 7, 2016 08:34 — forked from eligrey/gist:1079572
BlobBuilder.js
@rkalkani
rkalkani / icheck-angular.js
Created February 21, 2016 09:55
AngularJS directive for iCheck jquery plugin
/**
* @Company: winrtech
* @Author: rahul
*/
'use strict';
// Directive : icheck
// attributes
// data-label : To set element label or text
@rkalkani
rkalkani / angularjs-filter.js
Last active July 12, 2016 11:57
AngularJS custom filter code structure
(function() {
var filter = function(input) {
var output;
return output;
}
angular.module('App', [])
.filter('filter-name', filter);
@rkalkani
rkalkani / 01_Laravel 5 Simple ACL manager_Readme.md
Created May 30, 2016 04:48 — forked from amochohan/01_Laravel 5 Simple ACL manager_Readme.md
Laravel 5 Simple ACL - Protect routes by an account / role type

#Laravel 5 Simple ACL manager

Protect your routes with user roles. Simply add a 'role_id' to the User model, install the roles table and seed if you need some example roles to get going.

If the user has a 'Root' role, then they can perform any actions.

Installation

Simply copy the files across into the appropriate directories, and register the middleware in App\Http\Kernel.php

@rkalkani
rkalkani / list_all_file.php
Last active July 12, 2016 12:01
PHP script to print all file in directory and sub-directories recursively
<?php
// Origianlly : http://php.net/manual/en/function.scandir.php#110570
function printAllFile($dir) {
$result = array();
$cdir = scandir($dir);
foreach ($cdir as $key => $value)
{
if (!in_array($value,array(".","..")))
@rkalkani
rkalkani / dot-notation-object.js
Created July 18, 2016 11:11 — forked from likerRr/dot-notation-object.js
Adding string with dot-notation as a key to JavaScript objects
// Be careful when changing Object's prototype to avoid overwriting of methods
if (Object.prototype.setPath === undefined && Object.prototype.getPath === undefined) {
Object.prototype.setPath = function (path, value, notation) {
function isObject(obj) { return (Object.prototype.toString.call(obj) === '[object Object]' && !!obj);}
notation = notation || '.';
path.split(notation).reduce(function (prev, cur, idx, arr) {
var isLast = (idx === arr.length - 1);
// if <cur> is last part of path
if (isLast) return (prev[cur] = value);
@rkalkani
rkalkani / us-state-cities
Created December 29, 2016 06:55
united states cities with state and state code
[ { stateCode: 'AL', state: 'Alabama', city: 'Autauga' },
{ stateCode: 'AL', state: 'Alabama', city: 'Baldwin' },
{ stateCode: 'AL', state: 'Alabama', city: 'Barbour' },
{ stateCode: 'AL', state: 'Alabama', city: 'Bibb' },
{ stateCode: 'AL', state: 'Alabama', city: 'Blount' },
{ stateCode: 'AL', state: 'Alabama', city: 'Bullock' },
{ stateCode: 'AL', state: 'Alabama', city: 'Butler' },
{ stateCode: 'AL', state: 'Alabama', city: 'Calhoun' },
{ stateCode: 'AL', state: 'Alabama', city: 'Chambers' },
{ stateCode: 'AL', state: 'Alabama', city: 'Cherokee' },
@rkalkani
rkalkani / us-states
Created December 29, 2016 06:57
US states list with state code
[ { code: 'AL', state: 'Alabama' },
{ code: 'AK', state: 'Alaska' },
{ code: 'AZ', state: 'Arizona' },
{ code: 'AR', state: 'Arkansas' },
{ code: 'CA', state: 'California' },
{ code: 'CO', state: 'Colorado' },
{ code: 'CT', state: 'Connecticut' },
{ code: 'DE', state: 'Delaware' },
{ code: 'FL', state: 'Florida' },
{ code: 'GA', state: 'Georgia' },
# taken from http://www.piware.de/2011/01/creating-an-https-server-in-python/
# generate server.xml with the following command:
# openssl req -new -x509 -keyout server.pem -out server.pem -days 365 -nodes
# run as follows:
# python simple-https-server.py
# then in your browser, visit:
# https://localhost:4443
import BaseHTTPServer, SimpleHTTPServer
import ssl
@rkalkani
rkalkani / php-mongodb.sh
Last active September 5, 2017 05:26
Install php mongodb driver for mongodb 3.4
# Ubuntu 16.04
sudo apt-get install libcurl4-openssl-dev pkg-config libssl-dev libsslcommon2-dev
# Install php dev
sudo apt-get install php-dev
# for php5.6, sudo apt-get install php5.6-dev
# Install pecl
sudo apt-get install php-pear