Skip to content

Instantly share code, notes, and snippets.

Transformation Priority Premise

  • ({} → nil) no code at all → code that employs nil
  • (nil → constant)
  • (constant → constant+) a simple constant to a more complex constant
  • (constant → scalar) replacing a constant with a variable or an argument
  • (statement → statements) adding more unconditional statements.
  • (unconditional → if) splitting the execution path
  • (scalar → array)
  • (array → container)
@jeaguilar
jeaguilar / encryptDecryptWithAWSKMS.cfm
Last active February 23, 2021 05:18
Basic implementation of encryption and decryption in CFML using AWS KMS and the AWS SDK for Java (Tested on Lucee 4.5)
<cfscript>
// Step 1: Download AWS SDK for Java https://aws.amazon.com/sdk-for-java/
// Step 2: Copy [sdk archive]/lib/aws-java-sdk-1.10.47.jar to WEB-INF/lucee/lib
// Step 3: Create IAM User and obtain basic credentials (Access Key ID and Secret Access Key)
// Step 4: Create IAM Encryption Key add "Step 3 IAM User" as a Key User (remove as Key Administrator)
// Step 5: Obtain Key Id for "Step 4 IAM Encryption Key"
// Reference: http://docs.aws.amazon.com/kms/latest/developerguide/programming-top.html
public Any function getBasicAWSCredentials( required string AccessKeyId, required string SecretAccessKey ) {
return CreateObject(
@bobbygrace
bobbygrace / trello-css-guide.md
Last active April 2, 2024 20:18
Trello CSS Guide

Hello, visitors! If you want an updated version of this styleguide in repo form with tons of real-life examples… check out Trellisheets! https://github.com/trello/trellisheets


Trello CSS Guide

“I perfectly understand our CSS. I never have any issues with cascading rules. I never have to use !important or inline styles. Even though somebody else wrote this bit of CSS, I know exactly how it works and how to extend it. Fixes are easy! I have a hard time breaking our CSS. I know exactly where to put new CSS. We use all of our CSS and it’s pretty small overall. When I delete a template, I know the exact corresponding CSS file and I can delete it all at once. Nothing gets left behind.”

You often hear updog saying stuff like this. Who’s updog? Not much, who is up with you?

@rupl
rupl / drupal-test.js
Last active November 18, 2017 23:24
This sample accompanies a blog post series about CasperJS found at http://fourword.fourkitchens.com/article/testing-drupal-casperjs
/**
* @file
* Testing a demo of Drupal. The script will log in and check for various
* features in Drupal core. This demo was inspired by a similar script for
* a Wordpress site. The original script was written by Henrique Vicente.
*
* @see https://github.com/henvic/phantom-casper-simple-talk/blob/master/wordpress.js
*/
// Set up variables to visit a URL and log in.
@BradEstey
BradEstey / gulpfile.js
Last active December 21, 2018 05:49
Use Gulp to automatically run PHPUnit tests.
var gulp = require('gulp'),
sys = require('sys'),
exec = require('child_process').exec;
gulp.task('phpunit', function() {
exec('phpunit', function(error, stdout) {
sys.puts(stdout);
});
});
@ryanguill
ryanguill / receive-test.cfm
Last active December 13, 2015 16:39
the simple example for rabbitmq I set up. rabbitmq configuration was out-of-box, no changes, running on a virtualbox centos 6.3 vm with a gig of ram. Example of results:100000 messages sent in 13847 ms ( 7221.78089117 messages/second ). 100000 messages received in 20865 ms. ( 4792.71507309 messages/second )
<!---
--- NOTE: YOU NEED THE JAVA LIBRARY FROM HERE: http://www.rabbitmq.com/java-client.html
--- http://www.rabbitmq.com/tutorials/tutorial-one-java.html
--- https://github.com/rabbitmq/rabbitmq-tutorials/blob/master/java/Recv.java
import com.rabbitmq.client.ConnectionFactory;
import com.rabbitmq.client.Connection;
import com.rabbitmq.client.Channel;
anonymous
anonymous / fileservice.cfc
Created September 10, 2012 16:21
A convenience component with a simple API for managing files
<cfcomponent output="false" accessors="true">
<cfproperty name="fileRoot">
<cffunction name="init" access="public" output="false">
<cfargument name="fileRoot" required="true" />
<cfscript>
setFileRoot(arguments.fileRoot);
//initialize the directory where we store all the files
initializefileRoot();
return this;
</cfscript>
@tkarpinski
tkarpinski / web.config
Created January 16, 2012 14:43
webconfig for http to https redirect
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<rewrite>
<rules>
<rule name="HTTP to HTTPS redirect" stopProcessing="true">
<match url="(.*)" />
<conditions>
<add input="{HTTPS}" pattern="off" ignoreCase="true" />
</conditions>