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 / 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
);
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 / 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
<?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' => '::',
#!/bin/sh
git clone https://github.com/laravel/laravel.git $1
cd $1
# Required for getting L4 dev
git reset --hard HEAD
git checkout master
git remote rename origin upstream
{
"countries" : [
{
"code": "ZW",
"name": "Zimbabwe"
},
{
"code": "ZM",
"name": "Zambia"
},

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/
# Initial setup
git clone -o framework -b develop https://github.com/laravel/laravel.git project-name
cd project-name
git checkout --orphan master
git commit -m "Initial commit"
# Pulling changes
git fetch framework
git merge --squash -m "Upgrade Laravel" framework/develop
# Fix merge conflicts if any and commit
@byjamaljama
byjamaljama / conditional_js.php
Created October 16, 2011 07:25 — forked from peterwilsoncc/functions.php
Conditional commented JavaScript in WordPress
<?php
/* Hook the HTML5 shiv into WP. */
add_action('wp_print_scripts', 'mytheme_ie_specific_js');
/**
* Attaches conditionally commented JS file into wp_print_scripts hook.
*
* A modified version of Peter Wilson's gist https://gist.github.com/1282923
*