Skip to content

Instantly share code, notes, and snippets.

View ellor1138's full-sized avatar

Simon ellor1138

  • Maison
  • Montreal, Qc
View GitHub Profile
@18thAvenue
18thAvenue / functions.cfm
Created December 9, 2016 16:33
CFWheels Bootstrap 4 Pagination Function (Tag Based)
<!---
Instructions: Place this function in functions.cfm
In your findall():
myquery=model("Mymodel").findAll(page=params.page, perPage=params.perpage,handle="myHandleName");
In your view template place this code for the pagination links:
#bs4Pagination(paginationHandle="myHandleName",activepage="#params.page#",params="Not Required(optional params)")#
You can see in function arguments other parameters you can pass in from the bs4Pagination() function. --->
@neokoenig
neokoenig / settings.cfm
Created November 23, 2016 10:20
CFWheels Bootstrap3 form defaults
<cfscript>
// BS3 form settings
set(functionName="startFormTag");
set(functionName="submitTag", class="btn btn-primary", value="Save Changes");
set(functionName="checkBox,checkBoxTag", labelPlacement="aroundRight", prependToLabel="<div class=""checkbox"">", appendToLabel="</div>", uncheckedValue="0");
set(functionName="radioButton,radioButtonTag", labelPlacement="aroundRight", prependToLabel="<div class=""radio"">", appendToLabel="</div>");
set(functionName="textField,textFieldTag,select,selectTag,passwordField,passwordFieldTag,textArea,textAreaTag,fileFieldTag,fileField",
class="form-control",
labelClass="control-label",
labelPlacement="before",
@Nilpo
Nilpo / Using Git to Manage a Live Web Site.md
Last active October 31, 2024 13:38
Using Git to Manage a Live Web Site

Using Git to Manage a Live Web Site

Overview

As a freelancer, I build a lot of web sites. That's a lot of code changes to track. Thankfully, a Git-enabled workflow with proper branching makes short work of project tracking. I can easily see development features in branches as well as a snapshot of the sites' production code. A nice addition to that workflow is that ability to use Git to push updates to any of the various sites I work on while committing changes.

Contents

@timsayshey
timsayshey / CFWheels Model Logger
Last active February 17, 2023 23:25
CFWheels Model Logger
This will let you log every time a user inserts or updates a record.
So you can later say:
Tim performed insert to the "25" record in the Page table via Pages' Edit a few hours ago, etc
Create a table called Logs with the following columns:
id int primary autoinc
userid int
modelid varchar
savetype varchar
@orangexception
orangexception / gist:6907723
Created October 9, 2013 20:24
SQL SERVER DATERANGE - LAST 30 DAYS
-- SQL SERVER DATERANGE
-- Generates a list the last 30 dates.
WITH DATERANGE AS (
SELECT
CAST( CONVERT( VARCHAR , DATEADD( dd , -30 , GETDATE() ) , 101 ) AS DATETIME ) AS DATE
UNION ALL
SELECT
DATEADD( dd , 1 , DATE )
FROM DATERANGE
@learncfinaweek
learncfinaweek / gist:4121322
Created November 20, 2012 21:33
Document Handling - cfpdf

Whereas cfdocument is used to create PDFs, the cfpdf tag is used to manipulate existing PDFs. With cfpdf, you can read an existing PDF, write meta-data to it, merge PDFs together, delete pages, create thumbnails of the pages, extract text & images, add or remove watermarks, manipulate headers & footers, create PDF portfolios, and deal with PDF passwords, permissions and Encryption.

Reading a PDF

@timcunningham
timcunningham / fonts.cfm
Created September 27, 2012 14:03
List all fonts on ColdFusion Server
<cfset adminObj = createObject("Component", "cfide.adminapi.administrator")>
<cfset adminObj.login("yourpass")> <!--- change to use your CF Admin password --->
<cfset rtService = createObject("component", "cfide.adminapi.runtime")>
<cfset fonts = rtService.getFonts()>
<cfdump var="#fonts#">
@davidwaterston
davidwaterston / Geolocating IP Addresses for free using geoPlugin.net and ColdFusion
Created July 8, 2012 00:05
A ColdFusion function to grab geolocation details for an IP address using the free geoPlugin.net service.
<cfcomponent name="geoPlugin" output="no">
<cffunction name="ipLocation" access="remote" returntype="struct" displayname="ipLocation" output="no">
<!---
This function takes an IP address and passes it to http://www.geoplugin.net, a free GeoLocation service that
returns info about where that IP address is located i.e. city, country, etc. The returned data from geoPlugin
is cleaned up and returned as a ColdFusion structure.
Where the IP address is not passed in then geoPlugin.net will use the IP of the calling page. The IP used is
always returned in the 'geoplugin.request' variable.
@nkostic
nkostic / ArrayOfStructuresToQuery.cfm
Created March 26, 2012 12:56
Convert Array Of Structures To Query
<cffunction name="ArrayOfStructuresToQuery" access="public" returntype="query" output="false">
<cfargument name="StructArray" type="any" required="true" />
<cfscript>
KeyList=StructKeyList(arguments.StructArray[1]);
qbook = QueryNew(KeyList);
for(i=1; i <= ArrayLen(arguments.StructArray); i=i+1){
QueryAddRow(qbook);
for(y=1;y lte ListLen(KeyList);y=y+1){
QuerySetCell(qbook, ListGetAt(KeyList,y), arguments.StructArray[i][ListGetAt(KeyList,y)]);