Skip to content

Instantly share code, notes, and snippets.

View tonyjunkes's full-sized avatar
🍺
Cheers

Tony Junkes tonyjunkes

🍺
Cheers
View GitHub Profile
@tonyjunkes
tonyjunkes / .htaccess
Created June 25, 2013 23:11
Apache Mod_Rewrite .htaccess example to rewrite a URL to not include index.cfm
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !^.*\.(bmp|css|gif|htc|html?|ico|jpe?g|js|pdf|png|swf|txt|xml)$
RewriteRule ^(.*)$ index.cfm/$1 [NS]
@tonyjunkes
tonyjunkes / .htaccess
Created June 26, 2013 01:09
Apache Mod_Rewrite .htaccess example to rewrite a FW/1 Subsystem URL to be SES. Replace the example Subsystem (admin) with the actual Subsystem to be rewritten.
RewriteEngine On
RewriteRule ^admin/(.*)$ index.cfm/admin:$1 [L]
@tonyjunkes
tonyjunkes / .htaccess
Created June 26, 2013 01:25
Apache Mod_Rewrite .htaccess example to rewrite a FW/1 Subsystem URL to be SES and rewrite to remove index.cfm from URLs. Replace the example Subsystem (admin) with the actual Subsystem to be rewritten.
RewriteEngine On
#Rewrite FW/1 Subsystem
RewriteRule ^admin/(.*)$ index.cfm/admin:$1 [L]
#Rewrite index.cfm
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !^.*\.(bmp|css|gif|htc|html?|ico|jpe?g|js|pdf|png|swf|txt|xml)$
RewriteRule ^(.*)$ index.cfm/$1 [NS]
@tonyjunkes
tonyjunkes / .htaccess
Created June 26, 2013 05:09
.htaccess example for creating a more SES oriented URL. Replace "blog" and path info with desired string and path.
RewriteEngine On
RewriteRule ^blog/.*$ blog/show/post/$1
@tonyjunkes
tonyjunkes / Application.cfc
Last active December 18, 2015 23:59
Example pseudo code showing the use of FW/1 URL routes in the Application.cfc.
component extends="org.corfield.framework"
output="false"
{
/*
...Some code...
*/
VARIABLES.framework = {
routes = [
{ "/section/:value" = "/section/item/parameter/:value" } //Example - "/blog/:post" = "/blog/show/post/:post"
@tonyjunkes
tonyjunkes / ImageBrowser.cfc
Last active December 29, 2015 03:29
CFC for generating JSON data from a folder of images to be used with CKEditor's Image Browser addon.
component name="ImageBrowser"
output="false"
{
remote array function list(required string dir = "")
output="false"
returnformat="JSON"
{
var length = 0;
var path = var image = var folder = "";
var result = [];
@tonyjunkes
tonyjunkes / example.json
Created November 22, 2013 22:24
CKEditor Image Browser addon JSON example data.
[
{
"image": "/image1_200x150.jpg",
"thumb": "/image1_thumb.jpg",
"folder": "Small"
},
{
"image": "/image2_200x150.jpg",
"thumb": "/image2_thumb.jpg",
"folder": "Large"
@tonyjunkes
tonyjunkes / ckeditor-imagebrowser-example.js
Created November 22, 2013 23:00
CKEditor Image Browser addon setup example using ImageBrowser.cfc.
CKEDITOR.replace('textareaId', {
"extraPlugins": "imagebrowser",
"imageBrowser_listUrl": "/ImageBrowser.cfc?method=list&dir=/assets/images"
});
<cfscript>
set = {
one : {
alphabet : "a",
maori : "tahi",
roman : "i",
ordinal : "first"
},
two : {
@tonyjunkes
tonyjunkes / example-no-linkedhashmap.cfm
Last active August 29, 2015 14:22
Blog Post: Keeping Order With Java's LinkedHashMap (No LinkedHashMap Example)
<cfscript>
// Some dummy articles yay!
articles = [
{title: "I Am a Title Perhaps", publishDate: createDate(2015, 11, 08)},
{title: "I Am a Title As Well", publishDate: createDate(2014, 08, 15)},
{title: "I Am a Title I Think", publishDate: createDate(2014, 09, 25)},
{title: "I Am a Title", publishDate: createDate(2013, 04, 05)},
{title: "I Am a Title Too", publishDate: createDate(2013, 05, 17)},
{title: "I Am a Title Also", publishDate: createDate(2013, 07, 02)}
];