Skip to content

Instantly share code, notes, and snippets.

View neokoenig's full-sized avatar

Tom King neokoenig

View GitHub Profile
<cfprocessingdirective pageencoding="utf-8">
<cfheader name="Content-Disposition" value="attachment; filename=myworddoc.doc" charset="utf-8">
<cfcontent type="application/msword; charset=utf-8">
<html xmlns:o="urn:schemas-microsoft-com:office:office"
xmlns:w="urn:schemas-microsoft-com:office:word"
xmlns="http://www.w3.org/TR/REC-html40">
<head>
<style>
<!--[if gte mso 9]>
public string function getIPAddress() {
local.rv = "";
try {
try {
local.headers = getHttpRequestData().headers;
if (structKeyExists(local.headers, "X-Forwarded-For") && len(local.headers["X-Forwarded-For"]) > 0) {
local.rv = trim(listFirst(local.headers["X-Forwarded-For"]));
}
} catch (any e) {}
if (len(local.rv) == 0) {
// 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")){
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();
}
component extends="wheelsMapping.Test" hint="Unit Tests" {
include "../wheels/test.cfm";
function setup(){
}
function teardown(){
}
}
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 June 27, 2018 16:01
ArrayFind vs ArrayFilter as Member functions
<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";
module.exports = function(grunt) {
// Project configuration.
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
watch: {
sass:{
@neokoenig
neokoenig / routes.cfm
Created June 18, 2017 10:30
CFWheels 2.x routing
mapper()
.resources("users")
.root(to="wheels##wheels", method="get")
.end()
@neokoenig
neokoenig / routes.cfm
Created June 18, 2017 10:25
Old CFWheels 1.x style routing
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");