Skip to content

Instantly share code, notes, and snippets.

View aranw's full-sized avatar

Aran Wilkinson aranw

View GitHub Profile
@aranw
aranw / gist:1434090
Created December 5, 2011 16:04
Javascript Defer Test
if (document.getElementById('testing')) {
document.getElementById('testing').innerHTML = 'Text should load using javascript.';
}
@aranw
aranw / gist:1438402
Created December 6, 2011 14:38
Google Analytics Social Tracking Code
(function (b) {
(function (a) {
"__CF" in b && "DJS" in b.__CF ? b.__CF.DJS.push(a) : "addEventListener" in b ? b.addEventListener("load", a, !1) : b.attachEvent("onload", a)
})(function () {
"FB" in b && "Event" in FB && "subscribe" in FB.Event && (FB.Event.subscribe("edge.create", function (a) {
_gaq.push(["_trackSocial", "facebook", "like", a])
}), FB.Event.subscribe("edge.remove", function (a) {
_gaq.push(["_trackSocial", "facebook", "unlike", a])
}), FB.Event.subscribe("message.send", function (a) {
_gaq.push(["_trackSocial", "facebook", "send", a])
@aranw
aranw / gist:1452068
Created December 9, 2011 15:54
Sticky Scrolling
$(document).ready(function(){
function sticky() {
var y = $(window).scrollTop();
if( y > (60) ){
$('.postnav').css({
'position': 'fixed',
'top': '0',
'left': ($(window).width() - $('.container').width())/2 - 10
});
} else {
@aranw
aranw / dabblet.css
Created December 16, 2011 11:53 — forked from cdettmar/dabblet.css
Tiles
/**
* Tiles
*/
Body {
background: #515151;
min-height:100%;
margin: 0px;
}
.Tile {
@aranw
aranw / gist:2036706
Created March 14, 2012 14:08
Bootbox.js Confirm
$(document).on("click", "a.reset",function(e) {
e.preventDefault();
bootbox.confirm("Are you sure you want to reset this users password?", function(confirmed) {
if (confirmed)
{
$.ajax({
url: e.currentTarget.href,
success: function()
{
location.reload();
@aranw
aranw / gist:3810637
Created October 1, 2012 09:54
Unique Slug Code
public static function unique_slug($title)
{
$post_slug = \Str::slug($title);
$next_slug = null;
$i = 0;
do
{
if ($i == 0)
{
@aranw
aranw / gist:3818727
Created October 2, 2012 12:39
daneden.local vhost
// This snippet below needs to be added to your apache config.
// Or add a extra vhosts.conf file and include it into your httpd.conf file with line...
Include /private/etc/apache2/other/vhosts.conf
// vhosts.conf
<VirtualHost *:80>
DocumentRoot "/Library/Webserver/Documents/daneden.me/"
ServerName daneden
ServerAlias daneden.local
@aranw
aranw / gist:3868885
Created October 10, 2012 22:23
laurakalbag.com JS
(function($, window, document) {
// debouncing function from John Hann
// http://unscriptable.com/index.php/2009/03/20/debouncing-javascript-methods/
var debounce = function (func, threshold, execAsap) {
var timeout;
return function debounced() {
var obj = this,
args = arguments;
@aranw
aranw / gist:3908030
Created October 17, 2012 20:41
Blog Boxfile
web1:
name: blog
document_root: public
php_version: 5.3.8
after_build:
- "php composer.phar update"
shared_writeable_dirs:
- app/storage
php_extensions:
- mysql
@aranw
aranw / gist:3916930
Created October 19, 2012 08:23
Resizer Laravel Bundle
if ( ! file_exists($image->saved_to.$filename_stripped.'-480.'.$filename_ext))
{
$file = File::get(path('public').$image->saved_to.$image->filename);
$size_480 = Resizer::open($file)
->resize(480, 340, "crop")
->save($image->saved_to.$filename_stripped."-480.".$filename_ext);
var_dump($size_480);
}