Skip to content

Instantly share code, notes, and snippets.

View andreacfm's full-sized avatar

Andrea Campolonghi andreacfm

View GitHub Profile
@andreacfm
andreacfm / CFEM - Adding events
Created August 12, 2010 15:58
CFEM - Adding events
var events = [
{name = 'myevent'},
{name= 'anotherevent'}
]
//Using the contructor
var application.cfem = createObject('component','com.andreacfm.cfem.EventManager').init(events = events);
//Or At Runtime
application.cfem.setEvents(events);
@andreacfm
andreacfm / Railo Web Directory
Created August 15, 2010 06:54
Railo Web Directory
<!-- Default -->
<servlet>
<servlet-name>CFMLServlet</servlet-name>
<servlet-class>railo.loader.servlet.CFMLServlet</servlet-class>
<init-param>
<param-name>configuration</param-name>
<param-value>{web-root-directory}/WEB-INF/railo/</param-value>
<description>Configuraton directory</description>
</init-param>
<load-on-startup>1</load-on-startup>
@andreacfm
andreacfm / Mango Plugin Test
Created August 15, 2010 15:49
Test for mango plugin.
I am github gist!!!
@andreacfm
andreacfm / ant.restart-railo
Created September 30, 2010 19:46
Ant target to restart a railo server
<target name="restartRailo" description="Restarts the Railo server.">
<get
src="http://${server.name}:${server.port}/server/railo_restart.cfm?admin_password=${admin.password}"
dest="${www}/server/temp/restart_output.txt"/>
<loadfile property="restart.status" srcFile="${www}/server/temp/restart_output.txt"/>
<echo message="Restart status: ${restart.status}"/>
@andreacfm
andreacfm / railo.servlet-cfmlengine
Created September 30, 2010 19:49
Servlet that load and use the Railo AfmlEngineFactory
/**
*/
public class CFMLServlet extends HttpServlet implements EngineChangeListener {
private CFMLEngine engine;
/**
* @see javax.servlet.Servlet#init(javax.servlet.ServletConfig)
*/
public void init(ServletConfig sg) throws ServletException {
@andreacfm
andreacfm / jvm.args-jmx
Created September 30, 2010 19:51
jvm args to enable jmx support
-Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.port=9001 -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.authenticate=false
@andreacfm
andreacfm / websocket base
Created February 3, 2011 20:36
basic websocket js implementation
ws = new WebSocket('ws://{server_url}:{port});
ws.onopen = function(){
ws.send('hello');
}
ws.onmessage = function(ev){
do_things_with_incoming_message(ev.data);
}
sendGatewayMessage(String:name, Struct: data);
* name => the name of the gateway instance to invoke.
* data => a struct of data the gateway will process and will pass by to any listener function
@andreacfm
andreacfm / websocket data_push example - data.cfm
Created February 3, 2011 21:01
fake data push for the websockets stock example
<cfsetting requesttimeout="120">
<cfscript>
param name="gateway" default="stocks";
stocks = ['GOOG','APPL','MSFT','AMZN'];
thread action="run" name="stock_thread" stocks="#stocks#"{
while(true){
message = {};
for(item in attributes.stocks){
message[item] = randRange(1,5);
@andreacfm
andreacfm / gmaps_add_street_view.cfm
Created February 19, 2011 18:56
street view example bases on ray camden post
<script>
function init() {
ColdFusion.Map.addEvent("mainMap","click",function(overlay,overlaylnglt) {
address = arguments[arguments.length-1];
var loc = new GLatLng(address.lat(),address.lng());
panoramaOptions = { latlng:loc };
var myPano = new GStreetviewPanorama(document.getElementById("streetDiv"), panoramaOptions);
});
}
</script>