Skip to content

Instantly share code, notes, and snippets.

@Abban
Abban / sample-grunt.js
Created November 20, 2013 15:02
Grunt Sample file
module.exports = function(grunt)
{
// Project configuration.
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
sourceDir: 'themes/third_party/tickets',
cpjsFiles: [
'<%= sourceDir %>/js/cp-custom.js',
'<%= sourceDir %>/js/toolbar-tabs.js',
'<%= sourceDir %>/js/chosen.jquery.js',
@Abban
Abban / backboneSetTimeout.js
Last active December 22, 2015 10:48
Simple setTimeout bind for Backbone input fields
window.SearchView = Backbone.View.extend(
{
typingInterval: 1000,
el: '#search',
events:{
'keyup' : 'typed'
},
initialize: function()
{
@Abban
Abban / terminal.txt
Created July 15, 2013 06:34
Make Terminal remember previous windows on open
defaults write com.apple.Terminal NSQuitAlwaysKeepsWindows -bool true
@Abban
Abban / select.html
Created July 1, 2013 13:52
HTML Select Boxes That Don't Suck. For blog post (http://abandon.ie/notebook/simple-html-select-that-doesnt-suck)
<div class="select">
<select name="select_element">
<optgroup label="Option Group 1">
<option value="1">Option 1</option>
<option value="2">Option 2</option>
<option value="3">Option 3</option>
</optgroup>
<optgroup label="Option Group 2">
<option value="1">Option 1</option>
<option value="2">Option 2</option>
@Abban
Abban / anchor.php
Last active December 18, 2015 17:28
Get Anchor CMS Working on PHP 5.3.0+
<?php
// In anchor/libraries/anchor.php change lines 50 -65 from:
public static function functions() {
if( ! is_admin()) {
$fi = new FilesystemIterator(APP . 'functions', FilesystemIterator::SKIP_DOTS);
foreach($fi as $file) {
if($file->isFile() and $file->isReadable() and '.' . $file->getExtension() == EXT) {
@Abban
Abban / archives.php
Created June 19, 2013 18:25
Current Get Archives
<?php
$(function(){
var date = <?php echo get_the_date('F Y'); ?>';
$('.widget a[title="'+date+'"]').addClass('current');
});
<?php if(function_exists('abandon_cart_button')) abandon_cart_button('<div id="cart_button">', '</div>'); ?>
@Abban
Abban / css.css
Created June 19, 2013 18:04
Backbone loading spinner. First go and create and install a spinner on the spin.js website.
#loading{
position:fixed;
z-index:999;
top:0;
left:0;
width:100%;
height: 100%;
background:rgba(0,0,0,0.3);
}
@Abban
Abban / facebook-url-parse.php
Created June 19, 2013 17:54
Code To parse FB url and Twitter username
<?
protected function valid_facebook_url($field){
if(!preg_match('/^(http\:\/\/|https\:\/\/)?(?:www\.)?facebook\.com\/(?:(?:\w\.)*#!\/)?(?:pages\/)?(?:[\w\-\.]*\/)*([\w\-\.]*)/', $field)){
return false;
}
return true;
}
@Abban
Abban / EE-login-redirect.php
Last active December 18, 2015 15:39
Simple EE cookie redirect
<?php
/**
* logged in
*
* Programatically check logged in so EE doesnt parse a load of stuff if not
* Redirect if a redirection cookie has been set
*
* Usage
*