Skip to content

Instantly share code, notes, and snippets.

@jbuda
jbuda / gist:7050290
Created October 19, 2013 00:33
Ruby - Day 1 - Seven Languages in Seven Weeks
str = "Hello, Ruby"
idx = str.index("Ruby")
puts "Index of 'Ruby' is : #{idx}"
@jbuda
jbuda / gist:7050279
Created October 19, 2013 00:32
Ruby - Day 1 - Seven Languages in Seven Weeks
puts "Hello world"
@jbuda
jbuda / gist:6112527
Created July 30, 2013 12:35
A simple tab panel with a list component showing method for using a scrollable header and footer
Ext.define 'ListHeaderFooter.view.Main'
extend:'Ext.tab.Panel'
xtype:'main'
requires:[
'Ext.TitleBar'
'Ext.dataview.List'
]
config:
@jbuda
jbuda / gist:5575306
Created May 14, 2013 11:38
ColdFusion incomplete form fields
<input type="hidden" name="select_image" class="asset_required" value="1" />
<input type="hidden" name="upload_image" class="asset_required" value="0" />
@jbuda
jbuda / gist:5575276
Created May 14, 2013 11:30
Coldfusion form fields are incomplete or invalid
<input type="hidden" name="select_image_required" class="asset_required" value="1" />
<input type="hidden" name="upload_image_required" class="asset_required" value="0" />
@jbuda
jbuda / gist:5428631
Last active December 16, 2015 11:38
Saving YouTube/Vimeo thumbnails into Mura
<!--- get a list of videos that need embeddeding --->
<cfparam name="range" default="1" />
<cfparam name="relativePath" default="/_SITEID_/assets/Image/video-thumbs/" />
<cfparam name="saveDirectory" default="#expandPath(relativePath)#" />
<cfparam name="siteID" default="_SITEID_" />
<cfscript>
// create the save directory if it doesn't exist
if (!directoryExists(saveDirectory))
<cfscript>
colourArray = ["Red","Orange","Yellow","Green","Blue","Indigo","Violet"];
colourArrayTwo = ["Yellow","Green","Red","Violet"];
// duplicate one array as the result of retainAll remove the elements no present in both
// we want to keep the original array and return a new array
presentInBoth = duplicate(colourArray);
presentInBoth.retainAll(colourArrayTwo);
writeDump(presentInBoth);
@jbuda
jbuda / gist:5336134
Last active December 15, 2015 22:50
ColdFusion block to output the intersection of two arrays
<cfscript>
colourArray = ["Red","Orange","Yellow","Green","Blue","Indigo","Violet"];
colourArrayTwo = ["Yellow","Green","Red","Violet"];
presentInBoth = [];
// loop initial array with values
for(i=1;i<=arrayLen(colourArray);i++) {
// loop over inner array
for(j=1;j<=arrayLen(colourArrayTwo);j++) {
@jbuda
jbuda / gist:5262918
Created March 28, 2013 12:58
Grouped Sencha List to show only 2 items
Ext.define 'groupedlist.store.Stories'
extend:'Ext.data.Store'
config:
model:'groupedlist.model.Story'
autoLoad:false
grouper:
groupFn:(record)->
return record.get("section_name")
@jbuda
jbuda / gist:5262846
Created March 28, 2013 12:47
sample json for Sencha Group List
{
"stories":[
{"headline":"headline 1","section_name":"section_name 1"},
{"headline":"headline 2","section_name":"section_name 1"},
{"headline":"headline 1","section_name":"section_name 2"},
{"headline":"headline 1","section_name":"section_name 3"},
{"headline":"headline 2","section_name":"section_name 3"},
{"headline":"headline 2","section_name":"section_name 2"},
{"headline":"headline 3","section_name":"section_name 1"},
{"headline":"headline 4","section_name":"section_name 1"},