Skip to content

Instantly share code, notes, and snippets.

@KrunchMuffin
KrunchMuffin / association.cfm
Created May 23, 2012 00:31
cfwheels association help
<!--- pet model --->
<cfcomponent extends="Model" output="false">
<cffunction name="init" output="false" access="public">
<!--- relationships --->
<cfset hasOne(name="petProfile")>
<cfset hasMany(name="petDocuments", dependent="deleteAll")>
<cfset hasMany(name="personPets")>
<cfset hasMany(name="petEvents", dependent="deleteAll")>
<cfset hasMany(name="ViewPetEvents", foreignkey="petid")>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>KPI Dashboard</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" content="">
<!-- Le styles -->
<link href="../assets/css/jquery-ui-1.8.16.custom.css" rel="stylesheet">
@KrunchMuffin
KrunchMuffin / cfw.cfm
Created June 12, 2012 11:33
cfwheels help
<!--- PetMEdicalCondition --->
<cfcomponent extends="Model" output="false">
<cffunction name="init" output="false" access="public">
<cfset belongsTo(name="pet", dependent="deleteAll")>
<cfset belongsTo(name="medicalcondition", dependent="deleteAll", joinType="outer")>
</cffunction>
</cfcomponent>
@KrunchMuffin
KrunchMuffin / days of week.txt
Created November 28, 2018 03:45
Days of the week for various languages
Javascript, PostgreSQL, PHP [$cal->setFirstDayOfWeek(IntlCalendar::DOW_SUNDAY);]
0 = Sunday, 1 = Monday, 2 = Tuesday, 3 = Wednesday, 4 = Thursday, 5 = Friday, 6 = Saturday
SQL Server [SET DATEFIRST], ColdFusion, SQLite
7 = Sunday, 1 = Monday, 2 = Tuesday, 3 = Wednesday, 4 = Thursday, 5 = Friday, 6 = Saturday
Python [setfirstweekday()]
date.weekday
6 = Sunday, 0 = Monday, 1 = Tuesday, 2 = Wednesday, 3 = Thursday, 4 = Friday, 5 = Saturday
date.isoweekday()
@KrunchMuffin
KrunchMuffin / rules.py
Created September 28, 2020 20:15 — forked from miraculixx/rules.py
a simple python based rule engine
"""
(c) 2014 miraculixx at gmx.ch
"""
from shrutil.dictobj import DictObject
class RuleContext(DictObject):
"""
rule context to store values and attributes (or any object)
"""
def __init__(self):
// The second argument/parameter is expected to be a (callback) function
const findWaldo = function(names, found) {
names.forEach(e => {
if (e === 'Waldo') found();
});
};
const actionWhenFound = function() {
console.log('Found him!');
};
const nameInverter = function(name) {
const honorifics = ['MR.', 'MRS.', 'MS.', 'DR.'];
switch (name) {
case '':
return '';
case undefined:
throw new Error('Name is undefined');
}
let newName = name.trim();
@KrunchMuffin
KrunchMuffin / GraphicsMagick.cfm
Created February 24, 2022 19:10 — forked from JamoCA/GraphicsMagick.cfm
ColdFusion Custom Tag for GraphicsMagick. Faster than ColdFusion's CFImage/java processing. Smaller output files. Better CMYK compatibility. Works with more image formats. (Set timout=0 to have image manipulation performed in the background; 0ms)
<CFSETTING ENABLECFOUTPUTONLY="YES">
<!---
NAME: CF_GraphicsMagick
DESCRIPTION: ColdFusion wrapper for some GraphicsMagick routines. Faster than CFImage. Generates smaller images. Better
CMYK compatilibity (Adds compatibility to CF9.)
Works with more images formats, including EPS: http://www.graphicsmagick.org/formats.html
EXAMPLES:
<CF_GraphicsMagick action="AspectScale" Infile="#ImageIn#" Outfile="#imageOut#" width="#W#" height="#H#">
Expression Utility Objects
Besides these basic objects, Thymeleaf will offer us a set of utility objects that will help us perform common tasks in our expressions.
#dates: utility methods for java.util.Date objects: formatting, component extraction, etc.
#calendars: analogous to #dates, but for java.util.Calendar objects.
#numbers: utility methods for formatting numeric objects.
#strings: utility methods for String objects: contains, startsWith, prepending/appending, etc.
#objects: utility methods for objects in general.
#bools: utility methods for boolean evaluation.
#arrays: utility methods for arrays.