Skip to content

Instantly share code, notes, and snippets.

View byjamaljama's full-sized avatar
🎯
Focusing

Jamal Jama byjamaljama

🎯
Focusing
View GitHub Profile
@byjamaljama
byjamaljama / UserPolicy.php
Created September 2, 2017 02:06
Laravel policy to check if user can follow a user.
<?php
namespace App\Policies;
use App\User;
use Illuminate\Auth\Access\HandlesAuthorization;
class UserPolicy
{
use HandlesAuthorization;
@byjamaljama
byjamaljama / widget-repeatable-fields.php
Created March 13, 2016 20:35 — forked from manmar/widget-repeatable-fields.php
WP widget with dynamically added/repeatable fields
<?php
class Clients_Module_Widget extends WP_Widget {
function __construct() {
parent::__construct(
'client_logos', // Base ID
__('Clients', 'text-domain'), // Name
array( 'description' => __( 'Our Clients - logo list', 'text-domain' ), ) // Args
);
@byjamaljama
byjamaljama / gist:543ef55e17ea22a2be9c
Last active May 18, 2018 10:49
Dump Composer autoload, clear Laravel compiled classes and reoptimize everything in one go.
alias optimize="composer dump-autoload && php artisan clear-compiled && php artisan optimize"
@byjamaljama
byjamaljama / deploy
Last active October 1, 2018 22:06
My semi-automatic deployment script
#!/usr/bin/env bash
# Repository
REPOSITORY="username/project.git"
# GIT CLONE DIRECTORY
DIRECTORY="myproject"
# Path to project parent dir
PROJECT_PATH="path/to/project"
var gulp = require('gulp');
var sequence = require('run-sequence');
var es = require('event-stream');
var clean = require('gulp-clean');
var htmlReplace = require('gulp-html-replace');
var inject = require('gulp-inject');
var compass = require('gulp-compass');
var minifyCSS = require('gulp-minify-css');
var ngAnnotate = require('gulp-ng-annotate');
var uglify = require('gulp-uglify');
@byjamaljama
byjamaljama / mysql-create-utf8-db.sql
Created June 2, 2014 18:53
Creating MySQL utf8 database
CREATE DATABASE my_database CHARACTER SET utf8 COLLATE utf8_general_ci;
@byjamaljama
byjamaljama / 0_reuse_code.js
Created June 2, 2014 17:14
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
@byjamaljama
byjamaljama / mixins.scss
Last active December 27, 2015 07:28
Useful SASS Mixins: padding, margin, line-height, etc. I'll add more
$base-font-size: 16px!default;
$base-line-height: 24px!defaut;
/**
* FUNCTION: REM
* ------------------------------------------------------------------------------
<?php
class UserController extends \BaseController {
public function getLogin() {
return 'I\'m in!';
}
}
<?php
class BaseController extends Controller {
private $application_name = 'The Cool Kid';
protected $layout = 'base';
// The cool kids' way of handling page titles.
protected $title = array(
'parent' => '',
'seperator' => '::',