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 / 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 / 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 / .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/

Awesome PHP

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

Composer

Composer Related

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;
@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:

@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 / README.md
Last active September 29, 2016 23:23
How To Install Elasticsearch on an Ubuntu VPS

Install Java 8

Elasticsearch require Java, so we will install that now. We will install a recent version of Oracle Java 8 because that is what Elasticsearch recommends. It should, however, work fine with OpenJDK, if you decide to go that route.

Add the Oracle Java PPA to apt:

    * sudo add-apt-repository -y ppa:webupd8team/java

Update your apt package database:

@meSingh
meSingh / index.html
Created April 5, 2013 20:06
Back To Top button easing with jQuery
<a href="javascript:void(0)" class="backtotop">Back to Top</a>
<script type='text/javascript' src='http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js'></script>
<script type='text/javascript'> jQuery('.backtotop').click(function(){ jQuery('html, body').animate({scrollTop:0}, 'slow'); }); </script>
@meSingh
meSingh / install.sh
Last active March 16, 2018 21:57 — forked from insane-dev/install.sh
Lemp stack for Ubuntu 16.04 (PHP7, Nginx, MongoDB, Git, Composer(with asset plugin))
#!/bin/bash
echo "Please, enter your username, it will be added to 'sudo' and 'docker' groups during the process."
read USERNAME
if [ -z "$USERNAME" ] ; then
echo "Exiting... Done."
exit
else
echo "Adding user to 'sudo' group..."