Skip to content

Instantly share code, notes, and snippets.

View johnny13's full-sized avatar

Derek johnny13

View GitHub Profile
@johnny13
johnny13 / li3-bootlegger.php
Last active December 29, 2015 16:59
Lithium [ li3 ] PHP Composer InstallerInstall Li3 with composer library for plugins and hui repo in webroot
#!/usr/bin/php
<?php
/*
* -- li3-bootlegger --
* usage: php li3-bootlegger.php myapp
*
* note: run from server webroot. ie /var/www
* then your app will be availabel at http://yourserver.com/myapp
*
* this will setup composer.phar & hui with lithium.
@johnny13
johnny13 / User.php
Last active August 29, 2015 13:56
Lithium Li3 Form Auth Authentication
<?php
namespace app\models;
class Users extends \lithium\data\Model {
//Basic validation
public $validates = array(
'email' => array(
array('notEmpty', 'message'=>'You must include your email.')
<?php
//DYNAMIC STYLES
$this->styles('<link rel="stylesheet" type="text/css" href="http://paper.huement.com/css/prettyCheckable.css"></link>');
$this->styles('<link rel="stylesheet" type="text/css" href="http://paper.huement.com/css/bootstrap-tagsinput.css"></link>');
$this->styles('<link rel="stylesheet" href="http://paper.huement.com/css/jquery.fileupload.css">');
$this->styles('<link rel="stylesheet" href="http://paper.huement.com/bower_components/datepicker/css/datepicker.css">');
$this->styles('<link rel="stylesheet" type="text/css" href="http://paper.huement.com/bower_components/bootstrap-3-timepicker/css/bootstrap-timepicker.css"></link>');
//DYNAMIC SCRIPTS
<?php
$this->styles('<link rel="stylesheet" href="http://paper.huement.com/css/community.css?ver=3" type="text/css" />');
$this->styles('<link rel="stylesheet" href="http://paper.huement.com/bower_components/bootstrap-calendar/css/calendar.css">');
$this->scripts('<script type="text/javascript" src="http://paper.huement.com/bower_components/bootstrap-calendar/components/underscore/underscore-min.js"></script>');
$this->scripts('<script type="text/javascript" src="http://paper.huement.com/bower_components/bootstrap-calendar/components/jstimezonedetect/jstz.min.js"></script>');
$this->scripts('<script type="text/javascript" src="http://paper.huement.com/bower_components/bootstrap-calendar/js/language/es-MX.js"></script>');
$this->scripts('<script type="text/javascript" src="http://paper.huement.com/bower_components/bootstrap-calendar/js/language/es-ES.js"></script>');
$this->scripts('<script type="text/javascript" src="http://paper.huement.com/bower_components/bootstrap-calendar/js/calendar.js"></script>');
/*
* FreshLime Global Styles
*
* Version: 0.0.1
* GIST: https://gist.github.com/johnny13/10182836
*
*/
/* GLOBAL STYLES
-------------------------------------------------- */
.img-circle{behavior:url(/js/PIE.htc)}
.img-rounded{behavior:url(/js/PIE.htc)}
.img-thumbnail{behavior:url(/js/PIE.htc)}
.table-bordered{behavior:url(/js/PIE.htc)}
select,textarea,input,code,pre,kbd,pre{behavior:url(/js/PIE.htc)}
.input-group-addon{behavior:url(/js/PIE.htc)}
.btn{behavior:url(/js/PIE.htc)}
.dropdown-menu{behavior:url(/js/PIE.htc)}
.form-control{behavior:url(/js/PIE.htc)}
.panel{behavior:url(/js/PIE.htc)}
!!! 5
html(class='no-js')
head
meta(charset='utf-8')
meta(http-equiv='X-UA-Compatible', content='IE=edge')
title
meta(name='description', content='')
meta(name='viewport', content='width=device-width, initial-scale=1')
<?php
/**
* Lithium: the most rad php framework
*
* @copyright Copyright 2013, Union of RAD (http://union-of-rad.org)
* @license http://opensource.org/licenses/bsd-license.php The BSD License
*/
/**
* This configures your session storage. The Cookie storage adapter must be connected first, since
@johnny13
johnny13 / li3 postgres setup
Last active August 29, 2015 14:06
Lithium Li3 PHP PostgreSQL PostGIS Searching.
<?php
/* EXAMPLE OF HOW TO SETUP ALL YOUR LI3 FILES TO DO LOCATION BASED SEARCHING */
/* CONFIG/BOOTSTRAP/CONNECTIONS */
Connections::add('postpins', array(
'type' => 'database',
'adapter' => 'PostgreSql',
'host' => 'localhost',
@johnny13
johnny13 / sh_env_var_opts.sh
Last active December 7, 2016 23:04 — forked from KylePDavis/sh_env_var_opts.sh
Simple bash shell script templates. There are two versions: 1) simple env var based options, and 2) with added command line argument parsing and error handling.
#!/bin/bash -e
##################################################################################
# BASH SCRIPT TEMPLATE [GENERIC MESSAGE]
# USAGE:
# DESCRIPTION OF ENV VARS HERE
##################################################################################
set -e # exit on command errors (so you MUST handle exit codes properly!)
set -o pipefail # capture fail exit codes in piped commands