Skip to content

Instantly share code, notes, and snippets.

View neokoenig's full-sized avatar

Tom King neokoenig

View GitHub Profile
<cfif structkeyexists(evaluate(arguments.objectname), "featuredimage")>
<img src="#_getImagePath(src=evaluate(arguments.objectname).featuredimage)#">
</cfif>
@neokoenig
neokoenig / urlrewrite.xml
Last active August 29, 2015 14:12
cfwheels tuckey urlrewrite
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE urlrewrite PUBLIC "-//tuckey.org//DTD UrlRewrite 4.0//EN"
"http://www.tuckey.org/res/dtds/urlrewrite4.0.dtd">
<urlrewrite>
<rule>
<note>
Allow TomCat to have SES links.
</note>
<!--
@neokoenig
neokoenig / .gitignore
Created January 3, 2015 12:31
cfwheels railo gitignore
# Ignore Misc Folder
miscellaneous
# unpacked plugin folders
plugins/**/*
# files directory where uploads go
files
# DBMigrate plugin: generated SQL
db/sql
@neokoenig
neokoenig / example.html
Created August 6, 2014 13:54
Gridmanager save contents to hidden form field using external button
<!-- The Gridmanager canvas -->
<div id="mycanvas" class="clearfix"></div>
<!-- The Form-->
<form method="post" action="saveme" id="gridmanager-save">
<!-- hidden Field-->
<input type="hidden" name="mycontent" id="mycontent" />
<input type="submit" name="submit" class="submit" />
</form>
</div>
@neokoenig
neokoenig / Ajax.cfc
Created July 31, 2014 07:58
cfwheels simple ajax example
<cfcomponent extends="controller">
<cffunction name="init">
<cfscript>
provides("html,json");
filters(through="_isValidAjaxRequest", except="index");
</cfscript>
</cffunction>
<!--- This is called remotely;
isAjax() just confirms this is an ajax request;
@neokoenig
neokoenig / gist:3760336
Created September 21, 2012 08:15
Expandpath Compare
<cfoutput>
#expandPath(".")#<br /> <!--- for me outputs D:\websites\www.scribble.local\junk --->
#expandPath("/")#<br /> <!--- for me outputs d:\websites\www.scribble.local\. Note the difference in capitalisation of the drive letter --->
</cfoutput>
On Apache/Cfwheels/CF10:
/Volumes/Documents/www/foo/html
/Applications/ColdFusion10/cfusion/bin/redirect:/rewrite.cfm/
@neokoenig
neokoenig / gist:2924644
Created June 13, 2012 15:06
Example CFWHeels Forms for Per
<--- edit.cfm // NB, boostrapDateSelect() is using that bootstrap plugin I did--->
<cfparam name="Signpost">
<cfparam name="allCategories">
<cfoutput>
<cfif params.action EQ "edit">
<h1>Edit Signpost</h1>
<p>#linkTo(text="View Signpost", route="Signposts", action="view", key=Signpost.key(), class="btn btn-primary")#</p>
#startFormTag(action="update", route='admin', controller='Signposts')# #hiddenField(objectname="Signpost", property="id")#
<cfelse>
<h1>Add New Signpost</h1>
@neokoenig
neokoenig / latestPHPBB3
Created February 5, 2012 18:11
Get Latest Posts from PHPBB3 to display from another website
<?php
// This gets the latest posts from your PHPBB3 install and outputs them as a UL; results are limited to forum.id's 1,2 and 3 in this example;
$connection = mysql_connect(localhost,"YOURDATABASEUSER","YOURDATABASEPW") or die("Service Currently Unavailable");
$db = mysql_select_db("YOURPHPBB3DATABASENAME",$connection) or die("Service Currently Unavailable");
$sql = "SELECT `phpbb_topics`.`forum_id`, `phpbb_topics`.`topic_id`, `phpbb_topics`.`topic_title`, `phpbb_forums`.`forum_id`, `phpbb_forums`.`forum_name`,`phpbb_forums`.`parent_id` FROM `phpbb_topics`
Inner Join `phpbb_forums` ON `phpbb_forums`.`forum_id` = `phpbb_topics`.`forum_id` WHERE `phpbb_forums`.`parent_id` = 1 OR `phpbb_forums`.`parent_id` = 2 OR `phpbb_forums`.`parent_id` = 2
order by topic_last_post_time desc limit 0,10";
$result = mysql_query($sql) or die("Service Currently Unavailable");
echo "<ul>";
for($x=1;$x<=10;$x++){
@neokoenig
neokoenig / ActiveDirectoryLDAPcfWheels.cfm
Created September 18, 2011 14:12
Active Directory / LDAP example in cfWheels
<--------Main.cfc----------->
<cffunction name="init">
<cfscript>
// AD Auth, application wide: if I wanted to only restrict a subset a pages, I could use 'only' instead of except below.
// This filter call should be in every controller you wish to protect
filters(through="loginRequired", except="login,dologin");
// Login
verifies(only="dologin", post=true, params="username,password", error="Both username and password are required", handler="login");
</cfscript>
@neokoenig
neokoenig / gist:1136749
Created August 10, 2011 13:05
Nested Function example
#truncate(
text=stripTags(body),
length=300,
truncateString="#linkTo(
text='... Read More &raquo;',
route='blog',
action='view',
key=id)#"
)#