Skip to content

Instantly share code, notes, and snippets.

Adrian J. Moreno iknowkungfoo

Block or report user

Report or block iknowkungfoo

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@iknowkungfoo
iknowkungfoo / ColdFusion: Array of Structs to XML
Created Jun 6, 2019
ColdFusion function to convert an array of structs to proper XML.
View ColdFusion: Array of Structs to XML
<cffunction name="arrayOfStructsToXML" access="public" output="false" returntype="any">
<cfargument name="data" type="array" required="true">
<cfscript>
var buffer = createObject("java","java.lang.StringBuilder").init('');
var y = arrayLen(arguments.data);
var xData = "";
buffer.append('<games>');
for (local.x = 1; local.x <= local.y; local.x++) {
local.stGame = arguments.data[local.x];
buffer.append('<game>');
View [CF] Get ASCII of characters in a string
<cfoutput>
<cfloop from="1" to="#len(loadFields.body)#" index="q">
[#asc(mid(loadFields.body, q, 1))#]-
</cfloop>
</cfoutput>
View Work .zshrc
# If you come from bash you might have to change your $PATH.
# export PATH=$HOME/bin:/usr/local/bin:$PATH
# Path to your oh-my-zsh installation.
export ZSH=/Users/adrianmoreno/.oh-my-zsh
export NVM_DIR=~/.nvm
source $(brew --prefix nvm)/nvm.sh
# Set name of the theme to load. Optionally, if you set this to "random"
@iknowkungfoo
iknowkungfoo / blogcfc_to_markdown_03.cfm
Last active Oct 6, 2018
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
View blogcfc_to_markdown_03.cfm
<cfsavecontent variable="post">---
layout: post
title: "#blogTitle#"
date: #blog.post_date# #blog.post_time# -0500
categories: #blog.post_categories#
redirect_from:
- /blog/index.cfm/#year(blog.post_date)#/#month(blog.post_date)#/#day(blog.post_date)#/#blog.post_alias#/
- /blog/index.cfm/#year(blog.post_date)#/#month(blog.post_date)#/#day(blog.post_date)#/#blog.post_alias_lower#/
---
@iknowkungfoo
iknowkungfoo / blogcfc_to_markdown_02.cfm
Last active Oct 6, 2018
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
View blogcfc_to_markdown_02.cfm
<cfoutput>
<cfloop query="blog">
<cfset blogPost = blog.post_more>
<cfif len(blogPost) GT 0>
<cfset blogPost = reReplaceNoCase(blogPost, "\<\/h[0-9]\>", "", "all")>
<cfset blogPost = reReplaceNoCase(blogPost, "\<\h1\>", "#chr(35)# ", "all")>
<cfset blogPost = reReplaceNoCase(blogPost, "\<\h2\>", "#chr(35)##chr(35)# ", "all")>
<cfset blogPost = reReplaceNoCase(blogPost, "\<\h3\>", "#chr(35)##chr(35)##chr(35)# ", "all")>
<cfset blogPost = reReplaceNoCase(blogPost, "\<\h4\>", "#chr(35)##chr(35)##chr(35)##chr(35)# ", "all")>
<cfset blogPost = reReplaceNoCase(blogPost, "\<\h5\>", "#chr(35)##chr(35)##chr(35)##chr(35)##chr(35)# ", "all")>
View integerListToTable.sql
/*
******* Run on both main and US Soccer databases ********
*/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE FUNCTION dbo.integerListToTable ( @strString varchar(max))
View ArrayCollection
/**
* @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 Oct 6, 2018
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
View blogcfc_to_markdown_01.cfm
<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 Dec 13, 2018
This will output a list of all emails in a specific file or in a folder.
View grep_emails_in_files.md

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 Jan 4, 2018
Evolution of creating an array of structs from a ColdFusion query.
View coldfusion_array_of_structs.md

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
*/
You can’t perform that action at this time.