Skip to content

Instantly share code, notes, and snippets.

@mkhuramj
mkhuramj / .htaccess
Last active August 29, 2015 14:24 — forked from dr-dimitru/.htaccess
# ----------------------------------------------------------------------
# ROOT/ folder .htaccess
# ----------------------------------------------------------------------
# Laravel Note:
# Note: Laravel is designed to protect your application code,
# and local storage by placing only files that are necessarily
# public in the public folder. It is recommended that you either
# set the public folder as your site's documentRoot (also known as a web root)
# or to place the contents of public into your site's root directory
# and place all of Laravel's other files outside the web root.
<VirtualHost *:80>
# The ServerName directive sets the request scheme, hostname and port t$
# the server uses to identify itself. This is used when creating
# redirection URLs. In the context of virtual hosts, the ServerName
# specifies what hostname must appear in the request's Host: header to
# match this virtual host. For the default virtual host (this file) this
# value is not decisive as it is used as a last resort host regardless.
# However, you must set it for any further virtual host explicitly.
ServerName erepo.usiu.ac.ke
@mkhuramj
mkhuramj / _ide_helper.php
Last active August 29, 2015 14:26 — forked from barryvdh/_ide_helper.php
Laravel IDE Helper for Netbeans / PhpStorm / Sublime Text 2 CodeIntel, generated using https://github.com/barryvdh/laravel-ide-helper
<?php
/**
* A helper file for Laravel 5, to provide autocomplete information to your IDE
* Generated for Laravel 5.1.1 (LTS) on 2015-06-11.
*
* @author Barry vd. Heuvel <barryvdh@gmail.com>
* @see https://github.com/barryvdh/laravel-ide-helper
*/
namespace {
@mkhuramj
mkhuramj / gist:c8d6768f97492e5c22ae
Created December 3, 2015 12:17 — forked from adamfairholm/gist:af88caf5bd0e585154ed
Laravel's where date functions.
<?php
// Laravel has some date functions in the query builder that I never really
// see mentioned. Most of the time when a user needs to do a MONTH(col) select,
// they are advised to do something like this:
$employees = Employee::where(DB::Raw('MONTH(hired_at)'), '=', 4)->get();
// However, Laravel seems to have query builder functions that take care of this.
// The above query could be rewritten as:
$employees = Employee::whereMonth('hired_at', '=', 4)->get();
@mkhuramj
mkhuramj / README.md
Created December 6, 2015 09:51 — forked from oodavid/README.md
Deploy your site with git

Deploy your site with git

This gist assumes:

  • you have a local git repo
  • with an online remote repository (github / bitbucket etc)
  • and a cloud server (Rackspace cloud / Amazon EC2 etc)
    • your (PHP) scripts are served from /var/www/html/
    • your webpages are executed by apache
  • apache's home directory is /var/www/
@mkhuramj
mkhuramj / add-option-to-dropdown.js
Created January 21, 2016 11:04 — forked from paulund/add-option-to-dropdown.js
Add and Remove Options in Select using jQuery
$("#selectBox").append('<option value="option6">option6</option>');
@mkhuramj
mkhuramj / gist:6ab093400f97bcd7d2b0
Created March 28, 2016 15:48 — forked from JasonMortonNZ/gist:5499511
Laravel S3 image uploader
// Routes.php
Route::get('upload', function()
{
return View::make('upload-form');
});
Route::post('upload', function()
{
// Get and move uploaded file.
@mkhuramj
mkhuramj / 0_reuse_code.js
Created April 12, 2016 06:07
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@mkhuramj
mkhuramj / 1_phpunit-api.md
Created April 18, 2016 05:55 — forked from loonies/1_phpunit-api.md
PHPUnit Cheat Sheet

PHPUnit API reference

  • version 3.6

TODO

Check those constraints:

$this-&gt;anything()
@mkhuramj
mkhuramj / nginx.default.conf
Created August 13, 2016 19:43 — forked from santoshachari/nginx.default.conf
PHP5.6 and NGINX: Install PHP56-FPM, Nginx & MySQL on EC2 with Amazon Linux AMI
# Install linux update, followed by GCC and Make
sudo yum -y update
sudo yum install -y gcc make
# Install Nginx and php56-FPM
sudo yum install -y nginx php56-fpm
# Install php56 extensions
sudo yum install -y php56-devel php-mysql php56-pdo php56-pear php56-mbstring php56-cli php56-odbc php56-imap php56-gd php56-xml php56-soap