Skip to content

Instantly share code, notes, and snippets.

View modius's full-sized avatar
🇦🇺
Busy disrupting.

Geoff Bowers modius

🇦🇺
Busy disrupting.
View GitHub Profile
@modius
modius / setMachineAttributes.cfm
Last active December 25, 2015 11:19
Setting machine specific attributes.
<cffunction
name="setMachineAttributes" access="private" returntype="void" output="true"
hint="Sets machine specific variables as needed.">
<!--- developer/staging specific variables are overridden here --->
<cfset var machineName=createObject("java", "java.net.InetAddress").localhost.getHostName()>
<cfswitch expression="#machinename#">
<!--- modius machine --->
@modius
modius / vagrant-up-brief.log
Created April 3, 2013 11:06
Failed to load plugin: berkshelf
Greyhame:railo modius$ export set VAGRANT_LOG=info
Greyhame:railo modius$ vagrant up
INFO global: Vagrant version: 1.1.4
...
INFO vagrant: `vagrant` invoked: ["up"]
INFO environment: Environment initialized (#<Vagrant::Environment:0x000001022f2828>)
INFO environment: - cwd: /Users/modius/Kitchen/railo
INFO environment: Home path: /Users/modius/.vagrant.d
INFO environment: Local data path: /Users/modius/Kitchen/railo/.vagrant
INFO environment: Loading plugin from JSON: berkshelf
@modius
modius / vagrant-up-brief.log
Last active December 15, 2015 16:28
berkshelf-vagrant plugin issue; running vagrant 1.1.0 (with fix from https://github.com/RiotGames/berkshelf-vagrant/issues/3 in place) on Mountain Lion. (this also happens with vagrant 1.1.4 but don't have this machine handy)
Olorin:myberk modius$ export set VAGRANT_LOG=info
Olorin:myberk modius$ vagrant up
INFO global: Vagrant version: 1.1.0
...
INFO environment: Loading plugin from JSON: berkshelf-vagrant
ERROR root: Failed to load plugin: berkshelf-vagrant
ERROR root: -- Error: #<Gem::LoadError: Unable to activate berkshelf-vagrant-1.0.6, because net-ssh-2.2.2 conflicts with net-ssh (~> 2.6.6), net-scp-1.0.4 conflicts with net-scp (~> 1.1.0)>
ERROR root: -- Backtrace:
ERROR root: /Applications/Vagrant/embedded/lib/ruby/1.9.1/rubygems/specification.rb:1637:in `raise_if_conflicts'
/Applications/Vagrant/embedded/lib/ruby/1.9.1/rubygems/specification.rb:746:in `activate'
@modius
modius / s3-railo.cfm
Last active December 15, 2015 14:39
Basic prototype of image upload, processing and CDN storage.
<!--------------------------------------
Credit for the upload part (with some changes):
http://www.anujgakhar.com/2011/11/29/directly-uploading-a-file-to-amazon-s3-with-railo/
Performance improvements:
- store file initially in virtual disk first (ram://), do resize then write to s3
- define s3 path as railo mapping
- set region to correct region (defaults to us i believe)
---------------------------------------->
<!---
Have files showdown.js and a markdown file in the same directory.
--->
<cfscript>
manager = createObject("java", "javax.script.ScriptEngineManager").init();
jsEngine = manager.getEngineByName("js");
showdownJS = fileRead('#getDirectoryFromPath(getCurrentTemplatePath())#/showdown.js');
jsEngine.eval(showdownJS);
@modius
modius / gist:5262609
Last active December 15, 2015 12:49
CFML Example of PEGDOWN (https://github.com/sirthias/pegdown)
<!--- Load some demo markdown content --->
<cfset markdownString = fileRead("#getDirectoryFromPath(getCurrentTemplatePath())#/demo.txt")>
<!--- Directory containing all the necessary jar files. --->
<cfset jarDir = "#getDirectoryFromPath(getCurrentTemplatePath())#pegdown" />
<!--- Array of necessary classes --->
<cfset jClass = [
"#jarDir#/parboiled-java-1.1.3.jar"
, "#jarDir#/asm-all-4.1.jar"
@modius
modius / gist:839979
Created February 23, 2011 03:46
getContentObjects() is awesome
<!--- get speakers by category; year --->
<cfset qSpeakers = application.fapi.getContentObjects(typename="mxSpeaker", lProperties="objectid, label", orderBy="label", catspeaker_eq=stobj.metadata) />
<!--- or old and busted get speakers by category; year --->
<cfquery datasource="#application.dsn#" name="qSpeakers">
SELECT type.objectID, type.label, refobj.typename
FROM refObjects refObj
JOIN refCategories refCat ON refObj.objectID = refCat.objectID
JOIN mxSpeaker type ON refObj.objectID = type.objectID
WHERE refObj.typename = 'mxSpeaker'
<cfsetting enablecfoutputonly="true" />
<!--- @@displayname: Google News Sitemap --->
<!--- @@description: Generates a Google News Sitemap from dmNews content items. --->
<!--- @@cacheStatus: 1 --->
<!--- @@cacheTimeout: 60 --->
<!--- @@fuAlias: sitemap --->
<!---
// build sitemap xml
--------------------------------------------------------------------------------------------------->
<cfsetting enablecfoutputonly="true" />
<!--- @@displayname: Google Sitemap --->
<!--- @@description: Generates a Google Sitemap for all Navigation content items. --->
<!--- @@cacheStatus: 1 --->
<!--- @@cacheTimeout: 60 --->
<!--- @@fuAlias: sitemap --->
<!---
// build sitemap xml
--------------------------------------------------------------------------------------------------->
<!-- For example, within an extended ./myproject/packages/types/dmNews.cfc -->
<cffunction name="contentToIndex" returntype="query" description="Gets news content to index">
<cfset qContentToIndex = application.fapi.getContentObjects(typename="dmNews",lProperties="objectid",publishDate_lte=now(),expiryDate_gt=now()) />
<cfreturn qContentToIndex>
</cffunction>