Skip to content

Instantly share code, notes, and snippets.

<cfdump var="#test#">
@battlejj
battlejj / gist:2440635
Created April 22, 2012 01:06
Simple jQuery Plugin for Popping Hidden Content Sample Code
//Pop a hidden div
$('#myDiv').popup();
//close a popped div
$('#myDiv').popup('close');
@battlejj
battlejj / gist:2440658
Created April 22, 2012 01:13
Simple jQuery Plugin for Popping Hidden Content Sample Code
<html>
<body>
<div id="main">
<a id="showlink" href="?">Pop the hidden stuff</a>
</div>
<div id="hiding" style="display:none;">
<h2>You can't see us...unless you pop us up!</h2>
<p>This is a bunch of hidden stuff. <a href="?" id="closelink">Close it!</a></p>
</div>
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js"></script>
@battlejj
battlejj / correct.sql
Created April 22, 2012 02:38
Selecting Random IDs for a Subquery in MSSQL
INSERT INTO
Tickets(
StartedBy,
TicketText
)
SELECT TOP 1000
(SELECT TOP 1 id FROM Users WHERE 0.01 >= CAST(CHECKSUM(NEWID(), id) & 0x7fffffff AS float)/CAST (0x7fffffff AS int)) AS StartedBy,
Comments AS TicketText
FROM olddbserver.oldDB.dbo.Tickets
@battlejj
battlejj / download.cfm
Created April 22, 2012 02:46
Faux Single Use URLs with ColdFusion and Amazon S3
<cfset awsKey = "[YOUR AWS KEY]">
<cfset awsSecret = "[YOUR AWS SECRET]">
<cfset bucket = "[YOUR BUCKET]">
<cfset objectKey = url.file>
<cfset s3 = createObject('amazonS3').init(awsKey,awsSecret)>
<cfset myURL = s3.s3Url(bucket,objectKey,"regular",2)>
<cfoutput>#myURL#</cfoutput>
@battlejj
battlejj / wrong.js
Created April 25, 2012 14:48
Form won't submit like this
$('#createForm').bind("submit",function(e){
//stop default form submission
e.preventDefault();
//check the persons address, make sure it exists in google maps
findLocation();
//hook to listings form jquery object
$self = $(this);
//we need about a second or 2 to wait on the response from google maps to get the
//driving distance and driving time estimates before submitting on a success
window.setTimeout(function(){
@battlejj
battlejj / twitter-csshelp.css
Created April 25, 2012 14:51
Tweet button doesn't work
.custom-tweet-button a {
display: block;
padding: 2px 5px 2px 60px;
color:#2A7090;
background: url("http://platform0.twitter.com/widgets/images/tweet.png") no-repeat scroll 0 0 transparent;
}
.twitterDiv {
float:left;
border:none;
font-weight:bold;
@battlejj
battlejj / utils.cfc
Created April 25, 2012 14:59
Unzipping to amazons3 with CF
function upload(){
destinationBucket = "s3://my-bucket/my-destination-folder";
extractToS3(form.fileData,destinationBucket);
}
function extractToS3(zipFile,s3destination){
/* init our utils cfc */
var utils = new utils();
var from = "";
var to = "";
@battlejj
battlejj / allenabledfields.js
Created April 25, 2012 16:41
jQuery Quickie: IE Quirk w/ :enabled selector
$('input:not(:disabled)');
#include <iostream>
int main()
{
std::cout << "Hello, world!" << std::endl;
}