Skip to content

Instantly share code, notes, and snippets.

<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: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))
@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: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: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:7050279
Created October 19, 2013 00:32
Ruby - Day 1 - Seven Languages in Seven Weeks
puts "Hello world"
@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:7050294
Created October 19, 2013 00:35
Ruby - Day 1 - Seven Languages in Seven Weeks
10.times do
puts "janusz"
end
@jbuda
jbuda / gist:7050311
Created October 19, 2013 00:37
Ruby - Day 1 - Seven Languages in Seven Weeks
10.times do |idx|
puts "This is the sentence number #{idx+1}"
end
@jbuda
jbuda / gist:7050316
Created October 19, 2013 00:37
Ruby - Day 1 - Seven Languages in Seven Weeks
n = rand(100)
input = gets.chomp.to_i
while (input != n) do
puts (input < n) ? "Too low" : "Too high"
input = gets.chomp.to_i
end
puts "Correct! The answer was #{n}"