Skip to content

Instantly share code, notes, and snippets.

@Abban
Abban / InventoryItemTest.php
Last active Jan 31, 2020
Integration Tests for Abban's Test
View InventoryItemTest.php
<?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 Aug 29, 2015
Export Jigoshop Products
View jigoshop-export.sql
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 Aug 5, 2015
Simple 2D Waypoint Movement in Unity
View Mover.cs
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;
View aws_sdk_s3.php
<?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 Nov 20, 2013
Grunt Sample file
View sample-grunt.js
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 Oct 13, 2020
jQuery AJAX file uploads. Code for the following blog post: http://abandon.ie/notebook/simple-file-uploads-using-jquery-ajax
View handleUpload.php
<?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 Dec 22, 2015
Simple setTimeout bind for Backbone input fields
View backboneSetTimeout.js
window.SearchView = Backbone.View.extend(
{
typingInterval: 1000,
el: '#search',
events:{
'keyup' : 'typed'
},
initialize: function()
{
@Abban
Abban / terminal.txt
Created Jul 15, 2013
Make Terminal remember previous windows on open
View terminal.txt
defaults write com.apple.Terminal NSQuitAlwaysKeepsWindows -bool true
View select.html
<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 Apr 26, 2017
Add web environments to Anchor CMS
View db.php
<?php
switch (WEB_ENV)
{
case 'local':
case 'development':
case 'staging':
case 'preview':
return array(