Skip to content

Instantly share code, notes, and snippets.

Tom King neokoenig

Block or report user

Report or block neokoenig

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View gist:cd54c870007845fd500e7c624d1b9a63
// If a plugin has a jar or class file, automatically add the mapping to this.javasettings.
this.wheels.pluginDir = this.wheels.rootPath & "plugins";
this.wheels.pluginFolders = DirectoryList(this.wheels.pluginDir, "true", "path", "*.class|*.jar|*.java");
for (this.wheels.folder in this.wheels.pluginFolders) {
if(!structKeyExists(this, "javaSettings")){
this.javaSettings={};
}
if(!structKeyExists(this.javaSettings, "LoadPaths")){
View gist:a375b54a24ff79c5ec3dcac182c9c3aa
component extends="tests.Test" hint="Unit Tests" {
function setup(){
super.setup();
params = {controller="dummy", action="dummy"};
loc.controller = controller("dummy", params);
}
function teardown(){
super.teardown();
}
View Test.cfc
component extends="wheelsMapping.Test" hint="Unit Tests" {
include "../wheels/test.cfm";
function setup(){
}
function teardown(){
}
}
View Locations.cfc
component extends="app.controllers.Controller" hint="Locations Controller"
{
// Name of your model:
this.modelName="location";
// Optional nested properties to include:
// this.includeNestedProperties = "somethign";
function config() {
super.config();
}
function index(){
@neokoenig
neokoenig / index.cfm
Created Jun 27, 2018
ArrayFind vs ArrayFilter as Member functions
View index.cfm
<cfscript>
products = [
{"sku": "prod_one", "title": "Product One"},
{"sku": "prod_two", "title": "Product Two"},
{"sku": "prod_three", "title": "Product Three"},
{"sku": "prod_four", "title": "Product Four"}
];
skuToFind="prod_two";
View gist:c0603a6eec2187401050049d68d91dc9
module.exports = function(grunt) {
// Project configuration.
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
watch: {
sass:{
@neokoenig
neokoenig / routes.cfm
Created Jun 18, 2017
CFWheels 2.x routing
View routes.cfm
mapper()
.resources("users")
.root(to="wheels##wheels", method="get")
.end()
@neokoenig
neokoenig / routes.cfm
Created Jun 18, 2017
Old CFWheels 1.x style routing
View routes.cfm
addRoute(name="users", pattern="/users/[action]/[key]", controller="users");
addRoute(name="users", pattern="/users/[action]/", controller="users");
addRoute(name="users", pattern="/users/", controller="users", action="index");
View routes.cfm
<cfscript>
mapper()
.namespace("admin")
.resources("users")
.end()
.wildcard()
.root(to="wheels##wheels", method="get")
.end()
</cfscript>
View Users.cfc
component extends="Admin" {
function config() {
super.config();
verifies(except="index,new,create", params="key", paramsTypes="integer", handler="objectNotFound");
verifies(post=true, only="create,update,delete");
}
function index() {
users=model("user").findAll();
You can’t perform that action at this time.