Skip to content

Instantly share code, notes, and snippets.

View joshuaadickerson's full-sized avatar

Joshua Dickerson joshuaadickerson

View GitHub Profile
<?php
/**
*
*/
class Cache
{
const OPT_JITTER = 10;
const OPT_JITTER_ENABLE = 11;
const OPT_LOGGER = 20;
<?php
/**
* This is basically $txt, but a lot smarter
* @todo add Language classes for each language then move the language files to classes (\Translator\English\PostLanguage) to allow for namespacing
* instead of global $txt, the class would implement LanguageFileInterface which has public getText()
*
*/
class Translator extends ArrayObject
{
<?php
class ElkArte_Hook
{
protected $_hooks = array();
protected $_files = array();
protected $_path_replacements;
protected $_debug = false;
<?php
function elkc()
{
static $elkc;
if ($elkc === null)
$elkc = new Elk_Container;
return $elkc;
<?php
$app['random_string'] = $app->protect(function (array $options = array()) {
static $default_options = array(
'length' => 5,
'uppercase' => true,
'lowercase' => true,
'numeric' => true,
'special_chars' => false,
'chars' => 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789',
<form action="{{action}}" method="post" {{ form_enctype(form)}} >
{{form_errors(form)}}
<legend>{{legend}}</legend>
<ul>
<li>
{{ form_errors(form.title) }}
{{ form_label(form.title) }}
{{ form_widget(form.title) }}
</li>
@joshuaadickerson
joshuaadickerson / getRandomString.php
Last active December 17, 2015 21:29
get a random id (or any kind of string)
<?php
function getRandomString($options = array())
{
static $default_options = array(
'length' => 5,
'uppercase' => true,
'lowercase' => true,
'numeric' => true,
'special_chars' => false,
<fieldType name="plain_text" class="solr.StrField" sortMissingLast="true">
<!-- Analyzer to use when indexing a field of this type -->
<analyzer type="index">
<!-- make all text lowercase -->
<filter class="solr.LowerCaseFilterFactory" />
</analyzer>
<!-- Analyzer to use when matching against field of this type -->
<analyzer type="query">
<!-- make all text lowercase -->
<?php
namespace Groundup\Form;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolverInterface;
class Search extends AbstractType
{
<?php
function getRoute(array $parameters)
{
global $scripturl;
$param_string = '';
foreach ($parameters as $k => $v)
$param_string .= $k . '=' . $v . '&';