Skip to content

Instantly share code, notes, and snippets.

@Abban
Abban / InventoryItemTest.php
Last active January 31, 2020 13:01
Integration Tests for Abban's Test
<?php namespace GildedRose\Tests;
use GildedRose\InventoryItem;
use GildedRose\InventoryItemLegendary;
use GildedRose\InventoryItemTicket;
use GildedRose\Program;
use PHPUnit\Framework\TestCase;
class InventoryItemTest extends TestCase
@Abban
Abban / jigoshop-export.sql
Last active August 29, 2015 14:28
Export Jigoshop Products
SELECT
p.post_title AS title,
p.post_content AS description,
p.post_excerpt AS excerpt,
p.ID AS jigoshop_id,
IFNULL(pmp.meta_value, "") AS price,
IFNULL(pmp.meta_value, "") AS original_price,
IFNULL(pmw.meta_value, "") AS weight,
IFNULL(pms.meta_value, "") AS inventory,
IFNULL(pmsk.meta_value, "") AS sku,
@Abban
Abban / Mover.cs
Created August 5, 2015 11:21
Simple 2D Waypoint Movement in Unity
using UnityEngine;
using System.Collections;
public class Mover : MonoBehaviour
{
public Waypoint[] wayPoints;
public float speed = 3f;
public bool isCircular;
// Always true at the beginning because the moving object will always move towards the first waypoint
public bool inReverse = true;
<?php
// http://www.leofs.org/docs/s3_client.html
// i used composer with the following composer.json file and then called composer install
// {"require":{"aws/aws-sdk-php": "2.*"}}
require "vendor/autoload.php";
use Aws\Common\Enum\Region;
use Aws\S3\S3Client;
@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 / handleUpload.php
Last active October 13, 2020 06:39
jQuery AJAX file uploads. Code for the following blog post: http://abandon.ie/notebook/simple-file-uploads-using-jquery-ajax
<?php // You need to add server side validation and better error handling here
$data = array();
if(isset($_GET['files']))
{
$error = false;
$files = array();
$uploaddir = './uploads/';
@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 / db.php
Last active April 26, 2017 14:03
Add web environments to Anchor CMS
<?php
switch (WEB_ENV)
{
case 'local':
case 'development':
case 'staging':
case 'preview':
return array(