Skip to content

Instantly share code, notes, and snippets.

View andrew-dixon's full-sized avatar

Andrew Dixon andrew-dixon

View GitHub Profile
<cfscript>
random = createObject("java", "java.security.SecureRandom");
salt_bytes = javaCast("byte[]", [].set(1,50,0));
iterations = 10000;
key_length = 2048;
password = javaCast("char[]", ['p','a','s','s','w','o','r','d']);
random.nextBytes(salt_bytes);
cryptoSpec = createObject("java", "javax.crypto.spec.PBEKeySpec").init(password, salt_bytes, iterations, key_length);
skf = createObject("java", "javax.crypto.SecretKeyFactory");
keyFactory = skf.getInstance('PBKDF2WithHmacSHA1');
<?xml version="1.0" encoding="UTF-8"?>
<Context docBase="[docBase]">
</Context>
<Host name="[virtual host name]" appBase="[appBase]">
<Context path="" docBase="[docBase]" />
</Host>
<cfscript>
// If you don't set this then the searchParams structure will be uppercased when converted to JSON and cause ElasticSearch to error.
processingdirective preserveCase="true";
public struct function elasticSearchSearch( required string serverURL,
required struct searchParams,
required string index,
required string type) {
// Post the search parameters to the ElasticSearch index and type
http method="post" url="#arguments.serverURL#/#arguments.index#/#arguments.type#/_search" result="searchResponse" {
<cfscript>
// Query to retrieve some data from the database
variables.myData = queryExecute(
sql = "
SELECT *
FROM myTable
LIMIT 10
",
options = {datasource="#Application.myDSN#"}
);
// Include require nodejs modules
var gulp = require('gulp');
var gutil = require('gulp-util');
var concat = require('gulp-concat');
var less = require('gulp-less');
var compressor = require('gulp-compressor');
// Define paths
var paths = {
lessFile: 'includes/css/styles.less',
var gulp = require('gulp');
var gutil = require('gulp-util');
var less = require('gulp-less');
var paths = {
lessFile: 'includes/css/styles.less',
lessFiles: 'includes/css/*.less',
cssDir: 'includes/css'
};
<cfparam name="URL.searchTerm" default="">
<!DOCTYPE html>
<html lang="en">
<head>
<title>This is my example..</title>
</head>
<body>
<form action="example.cfm" method="GET">
<label for="searchTerm">Search: </label>