Skip to content

Instantly share code, notes, and snippets.

View robertz's full-sized avatar

Robert Zehnder robertz

View GitHub Profile
@robertz
robertz / endpointChat.cfc
Created June 3, 2013 21:54
Handler for the API endpoint
component
accessors=false
extends="coldbox.system.EventHandler"
{
property name="Logger" inject="logbox:logger:{this}";
property name="ChatService" inject="model";
// Posts a message to the stack
public void function put(Event, RC, PRC){
component name="ChatService" accessors="false" scope="application" {
property name="Logger" inject="logbox:logger:{this}";
property name="AntiSamy" inject="coldbox:plugin:AntiSamy";
public ChatService function init(){
variables.history = [];
variables.clients = [];
variables.messageCount = 0; // The ID of the last message
variables.birth = Now();
@robertz
robertz / gist:5667954
Created May 29, 2013 04:22
CFChat (old version) Core
<cfcomponent>
<cfscript>
variables.instance = structNew();
instance.chatHistory = arrayNew(1);
instance.clients = arrayNew(1);
instance.messageTotal = arrayLen(instance.chatHistory);
</cfscript>
<cffunction name="init" access="public" returntype="chat">
<cfreturn this/>
<cfoutput>
<cfscript>
Stripe = new data.Commerce.Stripe();
card = {
"number": "4242424242424242",
"exp_month": "12",
"exp_year": "2015",
"cvc": "123",
"name": "Java Bindings Cardholder",
"address_line1": "140 2nd Street",
component output="false" {
public any function init(){
variables.Stripe = createObject("Java", "com.stripe.Stripe");
Stripe.apiKey = "<YOUR SECRET KEY HERE>";
return this;
}
// https://github.com/jeisenlo/ColdFusion-Stripe-CFC
private numeric function timeToUTCInt(required timestamp date) {
@robertz
robertz / gist:5088049
Created March 5, 2013 04:38
Railo connector for nginx
location / {
# Rewrite rules and other criterias can go here
# Remember to avoid using if() where possible (http://wiki.nginx.org/IfIsEvil)
try_files $uri $uri/ @rewrites;
}
location @rewrites {
# Can put some of your own rewrite rules in here
# for example rewrite ^/~(.*)/(.*)/? /users/$1/$2 last;
rewrite ^/(.*)? /index.cfm/$1 last;
server {
listen 80;
server_name example.com;
root /var/www/example.com;
index index.cfm;
access_log /var/log/example_access.log;
error_log /var/log/example_error.log;
include drop.conf;
include railo.conf;
@robertz
robertz / gist:5048657
Created February 27, 2013 15:15
Using Stripe Java API to process a charge
<cfoutput>
<cfscript>
Stripe = createObject("Java", "com.stripe.Stripe");
Stripe.apiKey = "sk_test_mkGsLqEW6SLnZa487HYfJVLf"
defaultCardParams = createObject("Java", "java.util.HashMap");
defaultChargeParams = createObject("Java", "java.util.HashMap");
defaultCardParams.put("number", "4242424242424242");
defaultCardParams.put("exp_month", javaCast("int", 12));
defaultCardParams.put("exp_year", javaCast("int", 2015));
defaultCardParams.put("cvc", "123");
2013-01-28 08:10:45 Client Support: 4.0.6a - 13623 (worldserver-daemon)
2013-01-28 08:10:45
2013-01-28 08:10:45 A World of Warcraft: Cataclysm Core Emulator
2013-01-28 08:10:45 _/_/ _/ _/_/_/ _/_/ _/_/_/ _/_/_/_/
2013-01-28 08:10:45 _/ _/ _/ _/_/ _/ _/ _/ _/ _/ _/ _/ _/
2013-01-28 08:10:45 _/_/_/_/ _/_/ _/_/ _/ _/ _/ _/_/_/ _/_/_/
2013-01-28 08:10:45 _/ _/ _/ _/ _/ _/ _/ _/ _/ _/ _/
2013-01-28 08:10:45 _/ _/ _/ _/ _/ _/_/_/ _/_/ _/ _/ _/_/_/_/
2013-01-28 08:10:45 Arkania Community (c) 2013
2013-01-28 08:10:45 <http://arkania.net/>
@robertz
robertz / gist:4568027
Last active December 11, 2015 07:39
Sample Nginx configuration
server {
listen 80;
server_name my.site.com;
root /var/www/my.site.com;
location / {
# Rewrite rules and other criterias can go here
# Remember to avoid using if() where possible (http://wiki.nginx.org/IfIsEvil)
try_files $uri $uri/ @rewrites;
}
location @rewrites {