Skip to content

Instantly share code, notes, and snippets.

Mark Hayes mhayes

Block or report user

Report or block mhayes

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
mhayes / action_item.rb
Created Jun 15, 2010
A Mongoid implementation of meeting minutes
View action_item.rb
class ActionItem
field :due_date, :type => Date
field :completed, :type => Boolean
field :description
has_one_related :person
embedded_in :meeting, :inverse_of => :action_items
mhayes / sortOrder.js
Created Jul 1, 2010
Use to collect sort position from jqueryUI
View sortOrder.js
$(function() {
update:function(event,ui) {
var arr = $('#sortFields').sortable('toArray');
var newVal = "";
for(i=1; i<arr.length; i++) { newVal += arr[i] + ","; }
mhayes / migration.cfm
Created Jul 16, 2010
ColdFusion migrations idea
View migration.cfm
Database Migration Script:
Instructions here
<cfsavecontent variable="up">
<!--- The contents in this section will be used to apply your update --->
SELECT TOP 3 * FROM ats.vw_r
View col.cfc
component name="col" {
function init(
required string name,
required string displayName,
required string dataType="string",
required boolean canSort=false,
required boolean canDisplay=false
) {
variables.tbl = ""; =;
mhayes / base_template.rb
Created Aug 10, 2010
Rails3 application template
View base_template.rb
#sets up basic rails3 application structure with jquery-ujs
#remove index page
run "rm public/index.html"
@jquery_link = ""
@jquery_ujs_link = ""
#setup Gemfile
View articles.rhtml
<h1><%= @path %></h1>
<% if archives.length > 0 %>
<% archives.sort! {|x,y| y[:date] <=> x[:date] } %>
<% archives.collect {|a| a[:date].year }.uniq.each do |year| %>
<h3><%= year %></h3>
<% {|e| e[:date].year == year }.each do |entry| %>
View actionView.cfc
component output="no" {
public function fileAnchorTag(
required relativePath,
fileType) {
// determine file details
var fileInfo = GetFileInfo(ExpandPath(relativePath));
// set default params
mhayes / dprarray.cfc
Created Sep 3, 2010
ColdFusion array of structs sorting
View dprarray.cfc
component output="no" {
function init() {
variables.itemArray = [];
function append(item) {
ArrayAppend(variables.itemArray, arguments.item);
function sortBy(key){
mhayes / config.cfc
Created Nov 12, 2010
ColdFusion Environment Configuration Loader
View config.cfc
component {
function init(required string configFile) {
variables.configFile = arguments.configFile;
variables.loadSections = ["common", CGI.SERVER_NAME];
return getConfig();
private function getConfig() {
var config = StructNew();
mhayes / qr.rb
Created Dec 5, 2010
Converts text to QR Code using Google Charts API
View qr.rb
require 'net/http'
require 'uri'
print <<INFO
QR Code Generator
Generated codes will be saved to "label.png" in the current directory
print "Text to encode: "
label_contents = gets.strip
You can’t perform that action at this time.