Skip to content

Instantly share code, notes, and snippets.

View iknowkungfoo's full-sized avatar

Adrian J. Moreno iknowkungfoo

View GitHub Profile
/*
******* 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))
/**
* @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 August 26, 2025 21:52
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 / revealing_module_template.js
Last active July 20, 2021 17:52
JavaScript Revealing Module Template with jQuery setup
NameSpace.moduleName = function($) {
// Private variable, global to the module.
var _foo;
// Private variable, global to the module.
// Will represent a jQuery object.
var $_bar;
// Constructor
var init = function() {
@iknowkungfoo
iknowkungfoo / ChildTag.cfc
Last active August 29, 2015 13:56
A parent CFC uses implicit getters and setters with the property "data". A child CFC extends the parent with a defined setter for "data", which calls super.setData(). setData() is not found.
<!--- Child CFC, extends Parent --->
<cfcomponent displayName="ChildTag" output="false" accessors="true" extends="ParentTag">
<cfproperty name="wibble" type="string" required="true" />
<cffunction name="setData" output="false" returntype="void">
<cfargument name="data" type="string" required="true" />
<cfset super.setData(arguments.data & " via Child.") />
</cffunction>