Skip to content

Instantly share code, notes, and snippets.

Avatar
💭
I may be slow to respond.

Matt Thomas betweenbrain

💭
I may be slow to respond.
View GitHub Profile
@mudge
mudge / .htaccess
Created Nov 7, 2008
Remove file extensions in URLs with mod_rewrite but preserve 404 errors.
View .htaccess
# The following will allow you to use URLs such as the following:
#
# example.com/anything
# example.com/anything/
#
# Which will actually serve files such as the following:
#
# example.com/anything.html
# example.com/anything.php
#
@briancavalier
briancavalier / simple-promise-retry.js
Created Feb 24, 2011
A few general patterns for retries using promises
View simple-promise-retry.js
function keepTrying(otherArgs, promise) {
promise = promise||new Promise();
// try doing the important thing
if(success) {
promise.resolve(result);
} else {
setTimeout(function() {
keepTrying(otherArgs, promise);
@AmyStephen
AmyStephen / Messages.xml
Created May 19, 2012
Molajo Data Sources
View Messages.xml
<?xml version="1.0" encoding="utf-8"?>
<model
name="Messages"
catalog_type_id="0"
table="#__dummy"
primary_key=""
primary_prefix=""
get_customfields="0"
get_item_children="0"
use_special_joins="0"
@jlleblanc
jlleblanc / gist:2926803
Created Jun 13, 2012
Using JImage to create square profile pictures in two sizes, regardless of the original's orientation
View gist:2926803
<?php
$image = new JImage('/path/to/original.jpg');
$height = $image->getHeight();
$width = $image->getWidth();
if ($height > $width) {
$crop_square = $width;
$crop_top = ($height - $width) / 2;
@mbabker
mbabker / gist:3211464
Created Jul 30, 2012
Creating a category via component postflight
View gist:3211464
// Get the database object
$db = JFactory::getDbo();
// JTableCategory is autoloaded in J! 3.0, so...
if (version_compare(JVERSION, '3.0', 'lt'))
{
JTable::addIncludePath(JPATH_PLATFORM . 'joomla/database/table');
}
// Initialize a new category
@dongilbert
dongilbert / config.php
Created Aug 2, 2012
Override Core Joomla! Classes
View config.php
<?php
/**
* @package Joomla.Plugin
* @subpackage System.Overrides
*
* @copyright Copyright (C) 2012 Don Gilbert. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE
*/
define('OVERRIDES', dirname(__FILE__).'/overrides');
@malarkey
malarkey / Contract Killer 3.md
Last active Nov 29, 2022
The latest version of my ‘killer contract’ for web designers and developers
View Contract Killer 3.md

When times get tough and people get nasty, you’ll need more than a killer smile. You’ll need a killer contract.

Used by 1000s of designers and developers Clarify what’s expected on both sides Helps build great relationships between you and your clients Plain and simple, no legal jargon Customisable to suit your business Used on countless web projects since 2008

…………………………

@phproberto
phproberto / overridable-media.md
Last active Dec 10, 2015
Joomla! overridable media cheatsheet
View overridable-media.md
View Request.php
<?php
/**
* Mimetype for your file - requires PHP 5.3, not enabled on default by Windows
*/
$php_mime = finfo_open(FILEINFO_MIME);
$this->mime_type = strtolower(finfo_file($php_mime, $this->your_file_path_and_name));
finfo_close($php_mime);
// Thanks for great discussion from Ben Ramsey, Anthony Ferrara, Dave Reid, Jarvis Badgley
@jhafner
jhafner / git-open.sh
Created May 16, 2013
Open the current repo on Github. Script by Brian Edgerton.
View git-open.sh
#!/bin/bash
git_host='git@github.com:'
git_url='https://github.com/'
remote=`git config --get remote.origin.url`
host=${remote:0:15}
if [ $host = $git_host ]
then
url=${remote/$git_host/$git_url}