Skip to content

Instantly share code, notes, and snippets.

@joeyblake
joeyblake / gist:1198806
Created September 6, 2011 20:08
product search filter
<cffunction name="productSearchBar" displayname="Product Search Bar" access="public" output="true">
<cfargument name="formid" hook="formid" displayname="Form Name" required="yes" type="numeric">
<cf_ccms_getdata_ptsi formid="#formid#" thisthing=true>
<cfparam name="url.brand" default="">
<cfparam name="url.category" default="">
<cfparam name="url.subcategory" default="">
<cfif url.brand neq "" AND url.category neq "">
<cfset bd = lcase(ListFirst(url.brand,"'"))>
<cfset whereclse = "">
<cfif url.brand NEQ '0'>
@joeyblake
joeyblake / gist:1206562
Created September 9, 2011 15:46
Get ORM Model Extra Attribute Data
<cffunction name="getModelDescDefault">
<cfargument name="model" required="true">
<cfset z = CreateObject('models.#arguments.model#')>
<cfset fieldStruct = {}>
<cfloop array="#getMetaData(z).properties#" index="i">
<cfif StructKeyExists(i,'desc')>
<cfset fieldStruct['#i.name#']['desc'] = #i.desc#>
<cfset fieldStruct['#i.name#']['default'] = #i.default#>
</cfif>
</cfloop>
@joeyblake
joeyblake / gist:1217739
Created September 14, 2011 20:45
ul li Navigation Boilerplate
ul{
list-style:none;
margin: 0;
padding: 0;
}
ul li{float:left;}
ul li a{
display:block;
@joeyblake
joeyblake / gist:1229496
Created September 20, 2011 15:58
Articles with pagination Examples
<cffunction name="newsroom" output="true" access="public" displayname="Newsroom Display">
<cfargument name="section" required="false" default="Firm/Case News" displayname="News Section">
<cfargument name="pagename" required="false" default="newsroom" displayname="News Page">
<cfargument name="perpage" required="false" default="10">
<cf_ccms_getdata_ptsi formid="81" thisthing=true>
<cfset startrw = 1>
<cfset currentpage = 1>
<cfset whereclse = "">
<cfif StructKeyExists(url,'year')>
@joeyblake
joeyblake / gist:1245382
Created September 27, 2011 15:30
Suckerfish Dropdown css
#main_nav ul li:hover ul{
left:auto;
}
#main_nav ul li ul{
position:absolute;
top:44px;
z-index:3;
left:-3000em;
}
@joeyblake
joeyblake / gist:1313894
Created October 25, 2011 19:13
Example form embed
<cffunction name="contactForm" access="public" displayname="Contact Form" output="true">
<div class="detail_bg" style="background:url(/images/moreinfo_bg.png) no-repeat; width:822px; height:501px; margin-left:40px; ">
<div style="padding-top:6px; padding-left:24px;">
<h2 style="font-size:14px; text-transform:uppercase;">Request to be contacted by a member of sales</h2>
</div>
<div style="width:538px; margin-top:20px; margin:20px auto; line-height:normal;">
@joeyblake
joeyblake / gist:1334521
Created November 2, 2011 18:54
ORM Entity Load
varname = EntityLoad("FormBuilder_159",{Field_70=0,Deleted=0});
varname = EntityToQuery(varname);
@joeyblake
joeyblake / gist:1410996
Created November 30, 2011 21:34
Wordpress Oauth Baseclass
<?php
class SquidooStatsDashboard_WordPressOAuthSupport {
function oauth_template_redirect() {
if (preg_match( sprintf('#^/oauth/%s/([^/\?]+)#', get_class($this)), $_SERVER['REQUEST_URI'], $matches )) {
do_action('oauth_request', $matches[1]);
do_action('oauth_request_'.$matches[1]);
}
}
@joeyblake
joeyblake / gist:1472625
Created December 13, 2011 15:49
simple php form mail
<?php
/* These are the variable that tell the subject of the email and where the email will be sent.*/
$emailSubject = 'Customer Has a Question!';
$mailto = 'you@youremail.com';
/* These will gather what the user has typed into the fieled. */
$nameField = $_POST['name'];
@joeyblake
joeyblake / gist:1566752
Created January 5, 2012 19:19
get_bitly_link
function get_bitly_link($post_id){
$post = get_page($post_id);
if($post->post_status == "published" || 1 == 1){
if(false === ($short_link = get_post_meta($post_id,'bitly_link',true))){
$http = _wp_http_get_object();
$args['login'] = self::BITLY_USERNAME;
$args['apikey'] = self::BITLY_APIKEY;
$args['longUrl'] = get_permalink($post_id);
if(is_wp_error($response = $http->request('https://api-ssl.bitly.com/v3/shorten?'.http_build_query($args),array('method'=>'GET')))){
return $response;