Skip to content

Instantly share code, notes, and snippets.


Andrew McCombe euperia

View GitHub Profile
euperia / csvsplitter.php
Created May 26, 2017
Split a CSV file into chunks
View csvsplitter.php
#!/usr/bin/env php
function help() {
echo PHP_EOL . 'Usage: csvsplitter <input file> <number of lines>' . PHP_EOL;
if (!isset($argv[1])) {
echo PHP_EOL . "Please enter a csv filename";
euperia /
Created May 26, 2017
Remove files that are not what they appear to be
# Some image files were fetched from an URL and not validated.
# Hence we have files that have '.jpg' extensions but are actually HTML files.
# Clean these out
# Remove the `-i` from the `rm` if you don't want to manually confirm deletion
for f in `find ./ -type f -iname "*.jpg"`;
file "$f" | grep -q HTML
if [ $? -eq 0 ] ; then
euperia / vue2-table-example.html
Last active Sep 12, 2017
Sample Vue.js 2 table with rows
View vue2-table-example.html
<!DOCTYPE html>
<html lang="en">
<meta charset="UTF-8">
<title>Vue 2 table example</title>
<div id="app">
<table width="90%" border="1" cellpadding="2" cellspacing="2" v-show="sites.length > 0">
euperia / gist:d17df77ff5f7cad5dd87fd61bccf36d3
Created Aug 17, 2016
How to use Group By on a Magento Collection
View gist:d17df77ff5f7cad5dd87fd61bccf36d3
$collection = Mage::getModel('sales/order_item')->getCollection();
->addAttributeToFilter('updated_at', array('gt' => $this->reportStartDate))
->addAttributeToFilter('updated_at', array('lt' => $this->reportEndDate));
// this is where we add the group by
euperia / foreach.js
Created May 12, 2016
Javascript: forEach over arrays and Objects
View foreach.js
// forEach over Arrays
var items = ['fish', 'birds', 'dogs', 'cats'];
items.forEach(function(item, index) {
console.log(index + ': ' + item);
// forEach over Objects
var h2 = document.getElementsByTagName('h2');
View gist:05470f9807f750efaf16
Verifying that +euperia is my blockchain ID.
euperia / debug-bootstrap.css
Created Feb 27, 2015
Boostrap responsive debugging CSS.
View debug-bootstrap.css
* Use this to show which breakpoint the css is using
* when using Bootstrap responsive
body::before {
content: "xs";
position: fixed;
top: 0;
left: 0;
euperia / phantomgrab.js
Created Feb 23, 2015
Screengrab a website with phantom.js
View phantomgrab.js
* Phantomgrab - take a screenshot of a webpage
* Run with:
* phantomjs --ssl-protocol=any --ignore-ssl-errors=true phantomgrab.js
var page = require('webpage').create();