Skip to content

Instantly share code, notes, and snippets.

View jbroadway's full-sized avatar

John de Plume jbroadway

View GitHub Profile
@jbroadway
jbroadway / forms_form.php
Created July 2, 2014 15:54
Simple single-field form test. Save to apps/test/* (rename underscores to subfolders) and view the form at the URL /test/form
; <?php /*
[one]
not empty = 1
; */ ?>
@jbroadway
jbroadway / Boris.md
Last active August 29, 2015 13:57
Using Boris REPL with Elefant CMS.

Using Boris REPL with Elefant CMS

Note: Boris requires PHP's pcntl extension.

1. Install Boris via:

    composer.phar require d11wtq/boris

2. Add the provided bootstrap.php to your document root.

@jbroadway
jbroadway / langprefix.php
Created March 10, 2014 15:43
Rewrite internal links to always include a language prefix (Elefant CMS).
<?php
/**
* Rewrite internal links to always include a language prefix.
* Save this to a handler such as apps/myapp/handlers/langprefix.php
* then edit conf/config.php and add the following to the [Hooks]
* section:
*
* page/render[] = myapp/langprefix
*/
@jbroadway
jbroadway / Hide the admin URL in Elefant.md
Last active August 29, 2015 13:56
How to rename the /admin URL to /newadminpanel on an Elefant CMS website.
  1. Rewrite incoming requests by adding bootstrap.php to the document root folder.

  2. Rewrite outgoing data by adding adminrewrite.php to the apps/myapp/handlers folder.

  3. Add the following line to the [Hooks] section in conf/config.php:

     page/render[] = myapp/adminrewrite
    
  4. Using Nginx, add the following to your vhost:

     location ~ ^/admin/?$ {
    

error_page 404 /404.html;

@jbroadway
jbroadway / embedded.html
Created February 10, 2014 19:36
Modified apps/filemanager/views/gallery/embedded.html to add previews/next buttons
<link rel="stylesheet" type="text/css" href="/apps/filemanager/css/gallery_embedded.css" />
<script>
var gallery_desc = '{{ desc }}';
$(function () {
// load the first image
$('#gallery-view').attr ('src', $('.gallery').first ().attr ('href'));
if (gallery_desc === 'yes') {
$('#gallery-desc').html ($('.gallery').first ().data ('desc'));
} else {
$('#gallery-desc').hide ();
@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 / 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