Skip to content

Instantly share code, notes, and snippets.

View atuttle's full-sized avatar

Adam Tuttle atuttle

View GitHub Profile
// 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()
})
@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 / DataTypes.md
Created September 18, 2012 13:35 — forked from sipacate/DataTypes.md
Basics

In our last Chapter, we talked about variables, data and how to transport data around in your application. There are different kinds of data and each helps in specific ways.

Strings/Numbers

Is Simple: Yes

Strings and numbers are very easy to work with. To set a string or a number, just use the CFSET command like this:

<cfset aString = "hi">