Skip to content

Instantly share code, notes, and snippets.

View atuttle's full-sized avatar

Adam Tuttle atuttle

View GitHub Profile
@atuttle
atuttle / gist:4127365
Last active April 25, 2024 02:43 — forked from learncfinaweek/gist:4121263
Application.cfc

By now you've learned the basics of ColdFusion, script vs. tag syntax, scopes, how to deal with data, and even some code-reuse techniques. You're now able to write something useful, so it's time we introduce you to the Request Lifecycle.

You see, when someone requests a ColdFusion page, CF doesn't just start executing your code. There are several events that first take place, which you can be waiting for, and to which you can react. This is not strictly necessary, but you'll find that any complex application will eventually want to make use of some or all of these features, so it's best that you know about them. In order to react to these events, you need to have an Application.cfc file. ColdFusion has designated Application.cfc as a special component that it will automatically look for, and in which we can put our event listeners for request lifecycle events.

A Note on Terminolog
@atuttle
atuttle / timezones.cfm
Last active November 19, 2022 03:23
Dealing with Time Zones in ColdFusion
<!---
Many thanks to Sean Corfield and Ryan Guill who set me down the correct path of java.util.TimeZone
--->
<cfscript>
writeDump(label="Conversion Examples",var={
"0-local-tz": getSystemTZ()
,"1-local-now": now()
,"2-utc-now": toUTC(now())
,"3-eastern-now": TZtoTZ( getSystemTZ(), now(), "America/New_York" )
@atuttle
atuttle / Amazon S3 Upload.cfm
Created January 28, 2013 19:11
Upload files to Amazon S3 with ColdFusion. This is heavily based on code from Joe Danziger's s3.cfc: http://amazons3.riaforge.org/
<cffunction name="uploadToAmazonS3">
<cfargument name="fileName" required="true" />
<cfargument name="contentType" required="true" />
<cfargument name="data" required="true" />
<cfargument name="acl" default="public-read" />
<cfargument name="storageClass" default="STANDARD" />
<cfargument name="HTTPtimeout" default="300" />
<cfargument name="bucket" default="#getProperty('EmailAttachmentS3Bucket')#" />
<cfargument name="accessKeyId" default="#getProperty('EmailAttachmentS3AccessKeyId')#" />
<cfargument name="secretKey" default="#getProperty('EmailAttachmentS3SecretKey')#" />
// test/unit/services/SecurityFilterService
describe("Tests for SecurityFilterService", () => {
describe("Tests for isAuthorised", () => {
it("will reject a user that is not authorised to access the resource", () => {
service = new SecurityFilterSerivce() // might need mocked dependencies
result = service.isAuthorised("juniorUser", "/email/approve-copy", "patch")
expect result.toBeFalse()
})
// Menu: Run the Tutorial
// Description: Learn the basics of using Script Kit
// Author: John Lindquist
// Twitter: @johnlindquist
await cli(
"new",
"--template",
"tutorial",
"--message",

How to make an annual plan

Notes from this video by Jack Conte, CEO of Patreon (and member of band Pomplamoose, which I mention only because it's relevant to the video.)

Why?

  • Gives you a greater ability to focus on what matters
  • Helps you understand what you want and how to get it
  • Let's you live your dream

An annual plan consists of:

Working Code Podcast Patron Discord Code of Conduct

Welcome!

The Working Code Podcast Discord is a place for Patrons of the Working Code Podcast to chat about the podcast and anything else they want (within the reasonable limits outlined here).

The current admins are:

  • Adam Tuttle
@atuttle
atuttle / Makefile
Last active March 25, 2020 23:27
A quick makefile for setting up Folding@Home on OSX
# https://hub.docker.com/r/linuxserver/foldingathome/
up: .setup
docker start foldingathome
open:
open http://localhost:7396/
down:
docker stop foldingathome
@atuttle
atuttle / leeroy.cfg
Created October 20, 2011 15:02
This is my preseed file for auto-installing Ubuntu 11.04 on my Jenkins server
#### Contents of the preconfiguration file (for squeeze)
### Localization
# Preseeding only locale sets language, country and locale.
# The values can also be preseeded individually for greater flexibility.
#d-i debian-installer/language string en
#d-i debian-installer/country string NL
#d-i debian-installer/locale string en_GB.UTF-8
# Optionally specify additional locales to be generated.
#d-i localechooser/supported-locales en_US.UTF-8, nl_NL.UTF-8
d-i debian-installer/locale string en_US
@atuttle
atuttle / _readme.md
Last active October 1, 2018 12:34
Push Packt Free Book of the Day alert into your slack channel

Push alerts about the daily 🆓 Packt eBook into Slack

Install this globally. Yes, globally.

$ npm install -g scrape-html

Now create a local project somewhere: