Skip to content

Instantly share code, notes, and snippets.

@twelverobots
twelverobots / gist:4001416
Created November 2, 2012 13:38
Sieve of Eratosthenes - Jason
<!--- Create array of all numbers --->
<cfset aNumbers = [] />
<!--- Initialize Array with unmarked, except one --->
<cfset arraySet(aNumbers, 2, 1000, "unmarked") />
<cfset aNumbers[1] = "one" />
<!--- Loop over Array --->
<cfloop from="2" to="#arrayLen(aNumbers)#" index="numIndex">
<cfcomponent>
<cffunction name="getUserByUsername" access="public" returntype="query" output="false">
<cfargument name="username" type="string" required="true" />
<cfset var getUser = "" />
<cfquery name="getUser" datasource="blog-jason">
SELECT *
FROM USERS
WHERE username = <cfqueryparam value="#arguments.username#" cfsqltype="cf_sql_varchar" />
</cfquery>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Making Links</title>
<script>
window.onload = function() {
var links = [
{
<cfcomponent>
<cffunction name="QueryToStruct" access="public" returntype="any" output="false"
hint="Converts an entire query or the given record to a struct. This might return a structure (single record) or an array of structures.">
<!--- Define arguments. --->
<cfargument name="Query" type="query" required="true" />
<cfargument name="Row" type="numeric" required="false" default="0" />
<cfscript>
Dinner Stuff
Ice Cream
Cheese
Soy Milk
Milk
Bread
Bagels
Fresh Fruit
Laundry Soap
Dingo Sticks
<cfcomponent>
<cfset this.name = "sessionCookies_test" >
<cfset this.sessionManagement=true>
<cfset this.setdomaincookies = true >
<cfset this.sessioncookie.httponly=true> <!--- if cookie to be httponly --->
<cfset this.sessioncookie.timeout = "10" > <!--- session cookie age --->
<cfset this.sessioncookie.secure = "true" > <!--- only https session cookie --->
<cfset this.sessioncookie.domain = ".shilpikhariwal.com" > <!--- domain for which session cookies are valid --->
<cfset this.authcookie.timeout = createTimeSpan(0, 0, 0, 20) > authentication cookie age --->
<cfset this.sessioncookie.disableupdate = true > <!--- if session cookie can be modified by coldfusion tags --->
<Engine name="Catalina" defaultHost="localhost" jvmRoute="cfusion">
<!--For clustering, please take a look at documentation at:
/docs/cluster-howto.html (simple how to)
/docs/config/cluster.html (reference documentation) -->
<!--
<Cluster className="org.apache.catalina.ha.tcp.SimpleTcpCluster"/>
-->
<!-- Use the LockOutRealm to prevent attempts to guess user passwords
<Engine name="Catalina" defaultHost="11robots.com" jvmRoute="cfusion">
<Realm className="org.apache.catalina.realm.LockOutRealm">
<Realm className="org.apache.catalina.realm.UserDatabaseRealm"
resourceName="UserDatabase"/>
</Realm>
<Engine name="Catalina" defaultHost="11robots.com" jvmRoute="cfusion">
<Realm className="org.apache.catalina.realm.LockOutRealm">
<Realm className="org.apache.catalina.realm.UserDatabaseRealm"
resourceName="UserDatabase"/>
</Realm>
@twelverobots
twelverobots / FlashPointDamageCounter.js
Last active December 24, 2015 20:49
Flash Point: Fire Rescue Scripts for Roll20.net
var methods = methods || {};
methods.showExplosion = function () {
var exp = findObjs({name:"explosion"})[0];
toFront(exp);
exp.set("height", 720);
exp.set("width", 720);
exp.set("left", 800);
exp.set("top", 500);
sendChat("System", "The Building Collapsed");