Skip to content

Instantly share code, notes, and snippets.

View drewdhunter's full-sized avatar

Drew Hunter drewdhunter

  • Liverpool FC
  • Dundee
View GitHub Profile
@drewdhunter
drewdhunter / kebase.md
Created June 10, 2018 20:21
kebase.md

Keybase proof

I hereby claim:

  • I am drewdhunter on github.
  • I am drewdhunter (https://keybase.io/drewdhunter) on keybase.
  • I have a public key ASDi4MTqATFfJlm4EQ56jqjLmBLPWAWl0FixkxVfY-lw6wo

To claim this, I am signing this object:

@drewdhunter
drewdhunter / euler-1.hs
Created April 7, 2014 18:17
Euler 1 - Haskell
sum [x | x <- [1..999], x `mod` 3 == 0 || x `mod` 5 == 0 ]
@drewdhunter
drewdhunter / factorial.hs
Last active August 29, 2015 13:58
Factorial Haskell v PHP
factorial :: Integer -> Integer
factorial 0 = 1
factorial n = n * factorial (n-1)
<?php
$mage = realpath('app/Mage.php');
require_once $mage;
Mage::app();
PS1="\[\e[00;32m\]\u@\h\[\e[0m\]\[\e[00;37m\] > \[\e[0m\]\[\e[00;34m\]\t\[\e[0m\]\[\e[00;37m\] > \[\e[0m\]\[\e[00;36m\]\w\[\e[0m\]\[\e[00;37m\]\n\\$ \[\e[0m\]"
@drewdhunter
drewdhunter / parentless-products.sql
Last active April 25, 2017 05:32
Magento - find parent-less simple products
select
entity_id
FROM
catalog_product_entity
WHERE
type_id = 'simple'
AND(
entity_id NOT IN(
SELECT DISTINCT
(product_id)
(function(){
var cache = {};
this.templater = function templater(identifier, template, dataSource){
return cache[identifier] = cache[identifier] || function() {
for (var key in dataSource) {
if (dataSource.hasOwnProperty(key)) {
@drewdhunter
drewdhunter / Magento - core code pre commit hook
Last active December 31, 2015 20:08
Pre commit hook useful for Magento projects
#!/usr/bin/env bash
set -eu
declare -a file_patterns=('app/code/core' 'app/Mage.php$' '^index.php$')
exit_status=0
while read x file; do
for file_pattern in ${file_patterns[@]}; do
if [[ $file =~ $file_pattern ]]; then