Skip to content

Instantly share code, notes, and snippets.

View johnbacon's full-sized avatar
🤓
Hello, World!

John Bacon johnbacon

🤓
Hello, World!
View GitHub Profile
<?php
/**
* Custom configuration bootstrap file for ExpressionEngine
*
* Place config.php in your site root
* Add require(realpath(dirname(__FILE__) . '/../../config_bootstrap.php')); to the bottom of system/expressionengine/config/config.php
* Add require(realpath(dirname(__FILE__) . '/../../config_bootstrap.php')); to the bottom of system/expressionengine/config/database.php
* If you have moved your site root you'll need to update the require_once path
*
<!DOCTYPE html>
<!-- Helpful things to keep in your <head/>
// Brian Blakely, 360i
// http://twitter.com/brianblakely/
-->
<head>
<!-- Disable automatic DNS prefetching.
@necolas
necolas / snippet.js
Created June 14, 2011 20:36
Optimised async loading of cross-domain scripts
/*
* Updated to use the function-based method described in http://www.phpied.com/social-button-bffs/
* Better handling of scripts without supplied ids.
*
* N.B. Be sure to include Google Analytics's _gaq and Facebook's fbAsyncInit prior to this function.
*/
(function(doc, script) {
var js,
fjs = doc.getElementsByTagName(script)[0],
@mathiasbynens
mathiasbynens / jquery.loadasync.js
Created September 6, 2011 09:44
Use jQuery to load scripts asynchronously
// Load scripts asynchronously
jQuery.loadAsync = function(url, callback) {
// Don't use $.getScript since it disables caching
jQuery.ajax({
'url': url,
'dataType': 'script',
'cache': true,
'success': callback || jQuery.noop
});
};
@dalethedeveloper
dalethedeveloper / gist:1265499
Created October 5, 2011 19:53
Very Lazy Loading of Facebook Connect with jQuery
/*
Use jQuery to load FB Connect javascript asynchronously, then trigger manual parsing of individual XFBML tags
*/
window.fbAsyncInit = function() {
FB.init({channelUrl:'http://YOUR_SITE_URL.HERE/channel.html',xfbml: false,logging:false,status:false});
};
(function() {
jQuery(document).ready(function() {
jQuery.getScript('http://connect.facebook.net/en_US/all.js', function(){
var parseXFBML = function() {
@dciccale
dciccale / demo.html
Last active January 22, 2021 10:40
Styling radios & checkboxes using CSS3 (only for webkit)
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>Styling radios &amp; checkboxes using CSS3</title>
<link rel="stylesheet" media="screen" href="styles.css" >
</head>
<body>
<h1>Styling radios &amp; checkboxes using CSS3</h1>
@croxton
croxton / gist:1790604
Created February 10, 2012 16:23
Switchee devot:ee
{exp:switchee variable="{segment_1}/{segment_2}/{segment_3}" parse="inward"}
{case value = "//"}
{!-- s1, s2 and s3 are empty - Show home page --}
{embed="site/_home"}
{/case}
{case value="#^products/\S+/\S+$#"}
{!-- s1 is 'products', s2 and s3 are not empty - Show single products --}
{embed="site/_product"}
@croxton
croxton / gist:2135481
Created March 20, 2012 13:21
Stash embeds
I have a new tag {exp:stash:embed} which allows you to include Stash template files and store
in the database. Files can be fully or partially parsed when read before saving (set), OR
saved and then parsed on retrieval (get). Stash variables can be accessed in the Stash
template files as {stash:variable} and of course all the usual {global_variables} work as
expected.
An example:
{exp:stash:embed
name="news_listing"
@liamcurry
liamcurry / gist:2597326
Created May 4, 2012 19:56
Vanilla JS vs jQuery

Moving from jQuery

Events

// jQuery
$(document).ready(function() {
  // code
})
@neilbradley
neilbradley / case-studies.php
Created June 8, 2012 13:29
Viewing category with Switchee
{embed="_layouts/index"}
{preload_replace:channel="case_studies"}
{if group_id=="1"}
{preload_replace:featured_status="featured|closed"}
{preload_replace:preview_status="open|featured|closed"}
{if:else}
{preload_replace:featured_status="featured"}
{preload_replace:preview_status="open|featured"}
{/if}