Skip to content

Instantly share code, notes, and snippets.

View jbroadway's full-sized avatar

John de Plume jbroadway

View GitHub Profile
@jbroadway
jbroadway / Dockerfile
Last active February 4, 2016 02:00
Dockerfile for Nginx + PHP server.
FROM ubuntu:13.04
MAINTAINER Johnny Broadway "johnny@johnnybroadway.com"
RUN apt-get update
RUN apt-get install -y wget git vim postfix nginx sqlite
RUN apt-get install -y mysql-server mysql-client
RUN apt-get install -y php5-cli php5-common php5-mysql php5-sqlite php5-curl php5-fpm
RUN wget -O /etc/nginx/sites-available/default https://gist.github.com/jbroadway/6369183/raw/682a1ed8078cc39f59c3624f460b128addff95db/nginx-default
@jbroadway
jbroadway / config.php
Created January 15, 2014 15:09
Rename /blog to /collection in the Elefant CMS.
; <?php /* apps/collection/conf/config.php
[Collection]
title = Collection
include_in_nav = On
; */ ?>
@jbroadway
jbroadway / au
Last active January 2, 2016 06:08
A thin wrapper around ffmpeg to make it easier to perform common audio manipulations like cutting to a specific number of beats at a set BPM, volume adjustments, joining files together, and converting between file formats or between mono and stereo. Note: This project has been moved to https://github.com/jbroadway/au
This project has been moved to:
https://github.com/jbroadway/au
@jbroadway
jbroadway / images.html
Created December 10, 2013 18:27
Multi-image with drag and drop sorting in Elefant.
<!-- apps/test/views/images.html -->
{! filemanager/util/multi-image !}
<script>
$(function () {
$('#sub').click (function () {
console.log ($('#images').val ().split ('|'));
});
@jbroadway
jbroadway / admin.html
Created December 3, 2013 17:03
Sorting and paging in Elefant. This is a modified app that was initially created via `./elefant crud-app category id name order_by`.
<!-- apps/categories/views/admin.html -->
<p style="float: right">{"Sort"}:
{% if order === 'name' %}
Name | <a href="/categories/admin?order=order_by">Order</a>
{% else %}
<a href="/categories/admin?order=name">Name</a> | Order
{% end %}
</p>
@jbroadway
jbroadway / MyNav.php
Created August 27, 2013 19:06
Custom tree structures in Elefant.
<?php // apps/myapp/lib/MyNav.php
class MyNav extends Tree {
public function __construct ($file = null) {
$file = $file ? $file : Appconf::get ('myapp', 'Paths', 'navigation_json');
parent::__construct ($file);
}
}
?>
@jbroadway
jbroadway / Document.php
Created August 21, 2013 16:08
Many-many relations in Elefant.
<?php // apps/test/models/Document.php
namespace test;
class Document extends \Model {
public $table = 'test_document';
public $fields = array (
'types' => array (
'many_many' => 'test\Type',
@jbroadway
jbroadway / Type.php
Created August 21, 2013 15:40
Class for bitwise type value storage.
<?php
namespace myapp;
class Type {
const A = 1;
const B = 2;
const C = 4;
public static function is_a ($type) {
@jbroadway
jbroadway / select.html
Created August 20, 2013 19:58
Dynamically populated select box in an Elefant CMS template.
<!-- apps/test/views/select.html -->
<select name="type">
{% foreach options as val, label %}
<option value="{{val}}"{% if selected == $data->val %} selected{% end %}>{{label}}</option>
{% end %}
</select>
@jbroadway
jbroadway / multiple.html
Created August 20, 2013 20:32
Dynamically populated multiple select in an Elefant CMS form.
<!-- apps/test/views/multiple.html -->
<form method="post" id="{{_form}}">
<select name="type[]" multiple>
{% foreach options as val, label %}
<option value="{{val}}"{% if in_array ($data->val, $data->selected) %} selected{% end %}>{{label}}</option>
{% end %}
</select>