Skip to content

Instantly share code, notes, and snippets.

View iknowkungfoo's full-sized avatar

Adrian J. Moreno iknowkungfoo

View GitHub Profile
/**
* @author Adrian J. Moreno
* @website http://iknowkungfoo.com
* @Twitter: @iknowkungfoo
* @hint: A custom JSON render object for ColdFusion queries.
* @Repo: https://github.com/iknowkungfoo/cfquery-to-json
* @version 4.0
* @requirements ColdFusion 9.0+ or Railo 4+
* @BlogPost: http://cfml.us/Ce
*/
@iknowkungfoo
iknowkungfoo / blogcfc_to_markdown_01.cfm
Last active October 6, 2018 17:07
Convert BlogCFC blog posts to markdown files, which can then be imported into Jekyll static sites like Github Pages and Gitlab Pages. https://adrianmoreno.com/2018/10/06/converting-blogcfc-posts-to-markdown.html
<cfquery name="blog" datasource="iknowkungfoo">
SELECT
cte.post_id
, cte.post_title
, cte.post_body
, cte.post_more
, cte.post_date
, cte.post_time
, cte.post_alias
, group_concat(LCASE(cte.post_category) order by cte.post_category separator ' ') as post_categories
@iknowkungfoo
iknowkungfoo / grep_emails_in_files.md
Last active December 13, 2018 22:14
This will output a list of all emails in a specific file or in a folder.

File

Find in a single file:

grep -E -o "\b[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,6}\b" someFile.txt

Folder

@iknowkungfoo
iknowkungfoo / coldfusion_array_of_structs.md
Last active January 4, 2018 05:33
Evolution of creating an array of structs from a ColdFusion query.

While updating my cfquery-to-json repoistory to use the latest ColdFusiuon 2016 functions, I was amazed at how much less code it takes to return the same data structures.

ColdFusion 9+

/**
* Convert n query object to an array of structs.
* @param required query data Query Object
* @return array
*/
@iknowkungfoo
iknowkungfoo / git_quickstart.md
Last active May 26, 2022 17:02
A collection of common git commands.

Git Quick Start

Configure SSH

Create a new SSH key: ssh-keygen -t rsa

Accept default location, enter a password.

Enter file in which to save the key (/c/Users/user.name/.ssh/id_rsa):
@iknowkungfoo
iknowkungfoo / server.json
Last active May 3, 2018 16:22
CommandBox config for ColdFusion 9 on macOS
{
"name":"Test",
"debug":true,
"console":true,
"web":{
"host":"test.localhost",
"webroot":"wwwroot",
"directoryBrowsing":false,
"welcomeFiles":"index.cfm",
"http":{
<cfcomponent output="false" displayname="Spreadsheet Service">
<cffunction name="init" access="public" output="false" returntype="SpreadsheetService">
<cfreturn this />
</cffunction>
<cffunction name="createFromQuery" access="public" output="false" returntype="void">
<cfargument name="data" type="query" required="true" />
<cfargument name="xlsx" type="boolean" required="false" default="false" hint="File extension is xlsx (true) or xls (false)." />
<cfargument name="fileName" type="string" required="false" default="" hint="Final file name sent to the browser." />
<cfset var config = {
@iknowkungfoo
iknowkungfoo / gist:083c712a471715864f7e4869ab1af004
Last active August 2, 2017 16:33
Sublime Text 3 Installed Packages
{
"bootstrapped": true,
"in_process_packages":
[
],
"installed_packages":
[
"AdvancedNewFile",
"BracketHighlighter",
"CFML",
@iknowkungfoo
iknowkungfoo / gist:bb4005543f0293aa308e8c94acba5a98
Last active January 26, 2017 07:17
Sublime Text 3 User Config
{
"color_scheme": "Packages/Color Scheme - Default/Monokai.tmTheme",
"font_face": "Hack",
"font_size": 14,
"highlight_modified_tabs": true,
"ignored_packages":
[
"Vintage"
],
"trim_trailing_white_space_on_save": true
function finish {
/Applications/ColdFusion2016/cfusion/bin/coldfusion stop
}
trap finish 2
/Applications/ColdFusion2016/cfusion/bin/coldfusion start
tail -f /Applications/ColdFusion2016/cfusion/logs/coldfusion-out.log