Skip to content

Instantly share code, notes, and snippets.

View nastanford's full-sized avatar
🏠
Busy Coding

Nathan Stanford Sr nastanford

🏠
Busy Coding
View GitHub Profile
@nastanford
nastanford / code-1.cfm
Created August 8, 2024 20:52 — forked from bennadel/code-1.cfm
How My ColdFusion Code Snippet Color Coding Works
<cffunction
name="ColorCode"
access="public"
returntype="string"
output="false"
hint="This takes code samples and color codes for display.">
<!--- Define arguments. --->
<cfargument name="Code" type="string" required="true" />

MySQL Cheat Sheet

Help with SQL commands to interact with a MySQL database

MySQL Locations

  • Mac /usr/local/mysql/bin
  • Windows /Program Files/MySQL/MySQL version/bin
  • Xampp /xampp/mysql/bin

Add mysql to your PATH

@nastanford
nastanford / StarWars_Characters.html
Last active October 7, 2017 16:47
StarWars API jQuery Pull of the Characters in the Movies.
<!DOCTYPE html>
<html lang="en">
<head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>
<script src="http://cdnjs.cloudflare.com/ajax/libs/json2/20110223/json2.js"></script>
</head>
<body>
<style>
body {
font-family: Arial, Helvetica, sans-serif;
@wojteklu
wojteklu / clean_code.md
Last active December 12, 2024 01:59
Summary of 'Clean code' by Robert C. Martin

Code is clean if it can be understood easily – by everyone on the team. Clean code can be read and enhanced by a developer other than its original author. With understandability comes readability, changeability, extensibility and maintainability.


General rules

  1. Follow standard conventions.
  2. Keep it simple stupid. Simpler is always better. Reduce complexity as much as possible.
  3. Boy scout rule. Leave the campground cleaner than you found it.
  4. Always find root cause. Always look for the root cause of a problem.

Design rules

@bennadel
bennadel / code-1.cfm
Created March 25, 2014 00:30
How My ColdFusion Code Snippet Color Coding Works
<cffunction
name="ColorCode"
access="public"
returntype="string"
output="false"
hint="This takes code samples and color codes for display.">
<!--- Define arguments. --->
<cfargument name="Code" type="string" required="true" />
@nastanford
nastanford / loopFormFields.cfm
Last active December 19, 2015 01:49
Loop through form fields
<cfloop index="thefield" list="#form.fieldnames#">
<cfset fields="#thefield# = #form[thefield]#">
<cfset fields="#thefield# = #evaluate(thefield)#">
<cfoutput>#fields#</cfoutput><br>
</cfloop>
Example making the form fields into hidden Form Fields
<!--- ********************************************** --->
<cfloop index="thefield" list="#form.fieldnames#">
<input type="hidden" name="#thefield#" value="#form[thefield]#" />
@nastanford
nastanford / OracleOwner_TableAndColumns.cfm
Created June 21, 2013 17:11
Oracle - List Tables and Columns for each table for an Owner
<basefont face="arial" />
<CFSET REQUEST.DSN = "yourdatasource" />
<CFSET REQUEST.OWNER = "owner" />
<CFQUERY NAME="tables" Datasource="#REQUEST.DSN#" >
SELECT table_name
FROM all_tables
WHERE owner = '#REQUEST.OWNER#'
ORDER BY TABLE_NAME
</CFQUERY>
@adamcameron
adamcameron / Coldbox.cfc
Created December 30, 2012 18:06
Coldbox.cfc for Brad / Coldbox forum bods
component{
public void function configure(){
variables.coldbox = {
appName = application.applicationName, // I'm not over the moon about this break of encapsulation, but equally I want to be as DRY as possible. I dunno why I need to specify this (again)
appHomeUrl = "http://#CGI.http_host##CGI.script_name#",
defaultEvent = "bug.main",
// TODO: get rid once I understand what's going on
HandlersIndexAutoReload = true,
@nathanstanford2
nathanstanford2 / gist:4032110
Created November 7, 2012 15:02
Coldbox: Create Handler
<cfcomponent output="false" extends="coldbox.system.EventHandler">
<!--- Default Action --->
<cffunction name="index" returntype="void" output="false">
<cfargument name="event">
<cfset event.setView("general/mypdjfosdjfopjsapof")>
</cffunction>