Skip to content

Instantly share code, notes, and snippets.


Shankar Manamalkav mnshankar

View GitHub Profile
View vscode settings.json
"php.validate.executablePath": "C:\\laragon\\bin\\php\\php-7.1.14-Win32-VC14-x64\\php.exe",
"workbench.iconTheme": "material-icon-theme",
"workbench.statusBar.visible": false,
"editor.multiCursorModifier": "ctrlCmd",
"editor.snippetSuggestions": "top",
"editor.formatOnPaste": true,
"explorer.openEditors.visible": 0,
"workbench.activityBar.visible": true,
mnshankar / routes.php
Last active Jun 13, 2017 — forked from coreymcmahon/routes.php
Using macros to implement custom response types in Laravel -
View routes.php
Response::macro('csv', function($data, $filename = 'data.csv', $status = 200, $delimiter = ",", $linebreak = "\n", $headers = array())
return Response::stream(function () use ($data, $delimiter, $linebreak) {
foreach ($data as $row) {
$keys = array(); $values = array();
$firstPassComplete = (isset($firstPassComplete)) ? true:false;
foreach ($row as $k => $v) {
if (!$firstPassComplete){
mnshankar / Envoy.blade.php
Created Apr 15, 2014
Laravel Envoy script for easy VPS deployment
View Envoy.blade.php
@servers(['web' => 'mnshankar@'])
{{--"project" is the name of the project that is being deployed into /var/www/home--}}
rm -rf /var/www/home/project && mkdir /var/www/home/project
{{--Navigate to the project folder--}}
cd /var/www/home/project
mnshankar / nginx.conf
Last active Sep 9, 2020
Nginix config for hosting multiple laravel projects in sibling folders.
View nginx.conf
server {
listen 80;
root /vagrant;
index index.html index.htm index.php app.php app_dev.php;
# Make site accessible from
access_log /var/log/nginx/;
error_log /var/log/nginx/ error;
mnshankar /
Last active Jul 24, 2016
post-receive hook for git deploy (Laravel 4)
GIT_WORK_TREE=$WEBROOT git checkout -f
#change directory to the project dir
rm -f storage/cache/*
echo 'cache cleared'
rm -f storage/views/*
echo 'views cleared'
# Check if a composer.json file is present
mnshankar / macros
Last active Feb 26, 2020
Laravel 4 (Twitter Bootstrap 3.0 compliant) form macros that I commonly use
View macros
* Example usage (In view)
* <div class="welcome">
<?php echo Form::open(array('route'=>'process','class'=>'form-horizontal'))?>
<?php echo Form::textField('first_name')?>
<?php echo Form::textField('last_name')?>
<?php echo Form::emailField('email')?>
<?php echo Form::passwordField('password')?>
<?php echo Form::selectField('select_one', array('1'=>'abc', '2'=>'def'))?>
mnshankar / l4.formfield.php
Last active Dec 24, 2015
Form element in L4 (TBS styling)
View l4.formfield.php
<!-- email -->
<div class="form-group">
<?php echo Form::label('email',null,array('class'=>'col-lg-2 control-label'))?>
<div class="col-lg-4">
<?php echo Form::email('email', null,
array('class'=>'form-control', 'placeholder'=>'email'))?>
{{$errors->first('email', '<span class="alert alert-error">:message</span>')}}
You can’t perform that action at this time.