This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<cfcomponent> | |
<!--- | |
Function Name : linuxDateTime() | |
Author : Ryan Spencer | |
Created : 26/09/2008 | |
General Notes : Returns the date from a Epoch Time format of seconds | |
since UTC January 1, 1970, 00:00:00 (Epoch time). | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Create an index: | |
# | |
curl -XDELETE 'http://127.0.0.1:9200/articles' | |
curl -XPUT 'http://127.0.0.1:9200/articles' | |
# Insert the action mapping, as a child of articles: | |
# | |
curl -XPUT 'http://127.0.0.1:9200/articles/article/_mapping' -d ' | |
{ | |
"article": { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
curl -XPUT 'http://localhost:9200/twitter/tweet/1' -d '{ | |
"user" : "kimchy", | |
"post_date" : "2009-11-15T14:12:12", | |
"message" : "trying out Elastic Search" | |
}' | |
// {"ok":true,"_index":"twitter","_type":"tweet","_id":"1","_version":1} | |
curl -XPOST localhost:9200/twitter/tweet/1/_update -d '{ | |
"doc": { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<cfcomponent> | |
<cffunction name="upload" access="remote" returntype="struct" returnformat="json" output="false"> | |
<cfscript> | |
var uploadDir = expandPath('.') & '/uploads/'; // should be a temp directory that you clear periodically to flush orphaned files | |
var uploadFile = uploadDir & arguments.NAME; | |
var response = {'result' = arguments.NAME, 'id' = 0}; | |
var result = {}; | |
// if chunked append chunk number to filename for reassembly | |
if (structKeyExists(arguments, 'CHUNKS')){ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!------------------------------------------------------------------------------ | |
|| Component : CfscriptFunctions.cfc | |
|| Author : Jason Luttrell | |
|| Description : Provides a library of functions to be used by other CFCs. | |
|| Public Methods : cfabort | |
|| cfdump | |
|| cfhtmlHead | |
|| cfthrow | |
|| cfqueryofquery | |
|| etc... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<cfscript> | |
password="test1234"; | |
N = 65536; // CPU cost parameter. | |
r = 16; // Memory cost parameter. | |
p = 1; // Parallelization parameter. | |
// Note: SCryptUtil has default of 16 byte random salt and 256-bit key | |
SCryptUtil=createobject("java", "com.lambdaworks.crypto.SCryptUtil", "/path/to/scrypt-1.4.0.jar"); | |
// generate a hash | |
hashedPassword=SCryptUtil.scrypt(password, N, r, p); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
query function getSpecialtyCodeChartData(required numeric rc=99){ | |
var sc = queryExecute("Select specialtyname, qty From specialtycategorycount_view | |
Order by qty DESC, specialtyname",{},{maxrows = "#rc#"}); | |
return sc; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public void function onError(required any exception, required string eventname){ | |
//log error | |
writeLog(file='[LOG FILE NAME]', text='#arguments.exception.message#'); | |
//save error information in a single variable | |
savecontent variable='errortext' { | |
writeOutput("An error occurred: http://#cgi.server_name##cgi.script_name#?#cgi.query_string#<br /> | |
Time: #now().dateFormat('short')# :: #now().timeFormat('short')#<br />"); | |
writeDump(var=arguments.exception, label='Error Log'); | |
writeDump(var=form, label='Form Scope'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
curl -XPOST 'http://localhost:9200/fuzzytest/' -d ' | |
{ | |
settings: { | |
index: { | |
analysis: { | |
analyzer: { | |
default: { | |
type: "custom", | |
tokenizer: "uax_url_email", | |
filter: [ "lowercase" ] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<html> | |
<head> | |
<link rel="stylesheet" href="/examples/stylesheets/ui-lightness/jquery-ui-1.8.16.custom.css" type="css"> | |
<script type="text/javascript" src="/examples/javascripts/jquery.min.js"></script> | |
<script type="text/javascript" src="/examples/javascripts/jquery.base64.min.js"></script> | |
<script type="text/javascript" src="/examples/javascripts/jquery-ui-1.8.16.custom.min.js"></script> | |
<script type="text/javascript" src="/examples/javascripts/jquery.tmpl.min.js"></script> | |
</head> | |
<body> |