Skip to content

Instantly share code, notes, and snippets.

@mplacona
mplacona / file1.cs
Created July 28, 2012 21:34
RabbitMQ C# "Add to queue example"
//Declare queue name. This can be anything you like
string QueueName = "QTransactions";
// Create a new connection factory for the queue
var factory = new ConnectionFactory();
// Because Rabbit is installed locally, we can run it on localhost
factory.HostName = "127.0.0.1";
using (IConnection connection = factory.CreateConnection())
using (IModel channel = connection.CreateModel())
{
@mplacona
mplacona / sender.cfm
Created July 28, 2012 21:36
RabbitMQ ColdFusion "Add to queue example"
<cfscript>
QueueName = "QTransactions";
durable = true;
loadPaths = arrayNew(1);
loadPaths[1] = expandPath("lib/rabbitmq-java-client-bin-2.8.4/rabbitmq-client.jar");
// load jars
javaLoader = createObject("component", "lib.javaloader.JavaLoader").init(loadPaths);
@mplacona
mplacona / file1.js
Created July 28, 2012 22:09
ColdFusion (Java null)
// Returns a Java null from ColdFusion
function createJavaNull(){
var vector = CreateObject("java", "java.util.Vector");
vector.setSize(1);
return vector.get(0);
}
@mplacona
mplacona / file1.js
Created July 28, 2012 22:09
ColdFusion (Java Byte Array)
// Converts a ColdFusion string in a java byte array
function createByteArray(string){
var objString = createObject("Java", "java.lang.String").init(JavaCast("string", string));
return objString.getBytes();
}
@mplacona
mplacona / file1.cs
Created July 29, 2012 12:43
RabbitMQ C# "Read from queue example"
// Declare the queue name
string QueueName = "QTransactions";
// Create a new connection factory for the queue
var factory = new ConnectionFactory();
// Because Rabbit is installed locally, we can run it on localhost
factory.HostName = "127.0.0.1";
using (var connection = factory.CreateConnection())
using (var channel = connection.CreateModel())
{
@mplacona
mplacona / file1.js
Created August 24, 2012 12:53
Nivo Slider implementation
<link rel="stylesheet" href="theme/default.css" type="text/css" media="screen" />
<link rel="stylesheet" href="theme/nivo-slider.css" type="text/css" media="screen" />
<script type="text/javascript" src="scripts/jquery.nivo.slider.pack.js"></script>
<div class="slider-wrapper theme-default">
<div id="slider" class="nivoSlider">
<img src="images/image_1.jpg" alt="" title="" />
<img src="images/image_2.jpg" alt="" title="" />
<img src="images/image_3.jpg" alt="" title="" />
<img src="images/image_4.jpg" alt="" title="" />
@mplacona
mplacona / file1.js
Created August 24, 2012 13:57
Nivo Slider - Arrows Control
<script>
function arrowsCtrl () {
var SlideNo = jQuery('#slider').data('nivo:vars').currentSlide;
var TotalSlidesNo = jQuery('#slider').data('nivo:vars').totalSlides;
if (SlideNo==TotalSlidesNo-1) {jQuery('#slider .nivo-nextNav').hide();jQuery('#slider').data('nivoslider').stop();};
if (SlideNo==TotalSlidesNo-2) {jQuery('#slider .nivo-nextNav').show();jQuery('#slider').data('nivoslider').start();};
if (SlideNo==1) jQuery('#slider .nivo-prevNav').show();
if (SlideNo==0) jQuery('#slider .nivo-prevNav').hide();
};
@mplacona
mplacona / file1.js
Created August 24, 2012 14:13
Nivo Slider - Final JS
<script type="text/javascript">
$(window).load(function() {
$('#slider .nivo-nextNav').live('mouseover', function() {
$('img').attr("data-transition", "slideInLeft");
});
$('#slider .nivo-prevNav').live('mouseover', function() {
$('img').attr("data-transition", "slideInRight");
@mplacona
mplacona / file1.js
Created August 30, 2012 10:30
JMeter - JavaScript Date UDF
${__javaScript(var d=new Date();d.setDate(d.getDate() + 60); var date=d.getDate(); var month=d.getMonth()+1; $DATE=d.getFullYear() + "-" + (month<10?"0"+month:month) + "-" + (date<10?"0"+date:date);,DATE)}
@mplacona
mplacona / file1.java
Created November 28, 2012 13:23
ColdFusion - Java Null (2)
// Returns a Java null from ColdFusion
function createJavaNull(){
return javacast("null","");
}