Skip to content

Instantly share code, notes, and snippets.

View meSingh's full-sized avatar
😜
Making products..

Mandeep Singh meSingh

😜
Making products..
View GitHub Profile
@meSingh
meSingh / 01_Laravel 5 Simple ACL manager_Readme.md
Created June 10, 2016 07:38 — 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

@meSingh
meSingh / API.md
Created March 15, 2016 14:22 — forked from iros/API.md
Documenting your REST API

Title

<Additional information about your API call. Try to use verbs that match both request type (fetching vs modifying) and plurality (one vs multiple).>

  • URL

    <The URL Structure (path only, no root url)>

  • Method:

server {
listen 80;
listen [::]:80;
server_name site.com;
root /home/forge/site.com;
# FORGE SSL (DO NOT REMOVE!)
# ssl on;
# ssl_certificate;
# ssl_certificate_key;

Awesome PHP

A curated list of amazingly awesome PHP libraries, resources and shiny things.

Composer

Composer Related

@meSingh
meSingh / .gitignore
Last active December 20, 2015 04:59
Global .gitignore file
### Laravel ###
app/config/dev/
bootstrap/compiled.php
.env.*.php
.env.php
### Composer ###
composer.phar
vendor/
@meSingh
meSingh / nice_time_ago.php
Created July 1, 2013 13:37
Create nicely formatted timestamps in php
<?php
/**
*
* Creates nicely formated timestamps
*
* @param timestamp $date
* @return string
*/
public static function get_x_time_ago($date)
@meSingh
meSingh / truncate.php
Created July 1, 2013 13:32
Cut a string on a specific length or make the long string shorter in php with spaces support.
<?php
/**
*
* Make the string of a defined length
*
* @param string $string
* @param integer $max_length
* @param boolean $trunc_at_space
* @param string $replacement
@meSingh
meSingh / .htaccess
Created June 20, 2013 11:42
Laravel's (L3) .htaccess to remove "public" from URL
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteRule ^(.*)$ public/$1 [L]
</IfModule>
@meSingh
meSingh / custom.js
Created June 20, 2013 05:54
Link to a specific tab in bootstrap
var gotoHashTab = function (customHash) {
var hash = customHash || location.hash;
var hashPieces = hash.split('?'),
activeTab = $('[href=' + hashPieces[0] + ']');
activeTab && activeTab.tab('show');
}
// onready go to the tab requested in the page hash
gotoHashTab();

Launch Sublime Text 2 from the Mac OS X Terminal

Sublime Text 2 ships with a CLI called subl (why not "sublime", go figure). This utility is hidden in the following folder (assuming you installed Sublime in /Applications like normal folk. If this following line opens Sublime Text for you, then bingo, you're ready.

open /Applications/Sublime\ Text\ 2.app/Contents/SharedSupport/bin/subl

You can find more (official) details about subl here: http://www.sublimetext.com/docs/2/osx_command_line.html

Installation