Skip to content

Instantly share code, notes, and snippets.

Arthur Embleton aembleton

Block or report user

Report or block aembleton

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@aembleton
aembleton / getPrettyDateRange.php
Created Apr 15, 2015
PHP function to create a date range such as '1st - 4th May 2015' or '28th August - 2nd September 2015'
View getPrettyDateRange.php
function getPrettyDateRange($fromDate, $toDate) {
$fromTime = strtotime($fromDate);
$toTime = strtotime($toDate);
$fromDay = date("jS", $fromTime);
$fromMonth = date("F", $fromTime);
$fromYear = date("Y", $fromTime);
$toDay = date("jS", $toTime);
$toMonth = date("F", $toTime);
@aembleton
aembleton / Ordnance-Survey.tms
Created Feb 19, 2015
Ordnance Survey map to be used in QLandkarte GT.
View Ordnance-Survey.tms
<TMS>
<Title>Ordnance Survey</Title>
<Layer idx="0">
<Script><![CDATA[
(
function convert(z1, x1, y1)
{
serverpart = 0
serverpart = (serverpart + 1) % 4;
function encodeQuadTree(zoom, tilex, tiley)
@aembleton
aembleton / UnicodeTranslator.scala
Last active Aug 29, 2015
Translates between ASCII and unicode.
View UnicodeTranslator.scala
import scala.annotation.tailrec
object UnicodeTranslator {
private lazy val unicodeRegex = """(\\u[0-9a-fA-F]{4})""".r
def escapeUnicode(stringToEscape:String) = stringToEscape.foldLeft("") { (escaped, char) =>
if (char <= 127) {
escaped + char
} else {
@aembleton
aembleton / activator.fish
Created Jul 16, 2014
Add Activator for Play Framework to fish command line
View activator.fish
function activator
~/Downloads/activator-1.2.3-minimal/./activator $argv
end
@aembleton
aembleton / StringUtils.scala
Last active Dec 28, 2015
Implict String Utilities
View StringUtils.scala
package util
/**
* Created with IntelliJ IDEA.
* User: arthur
* Date: 17/11/13
* Time: 22:26
* To change this template use File | Settings | File Templates.
*/
object StringUtils {
@aembleton
aembleton / ImageUtil.scala
Created Nov 18, 2013
Implicit ImageUtil class for manipulating images
View ImageUtil.scala
package util
import java.awt.image.BufferedImage
import java.awt.{Color, Image}
/**
* Created with IntelliJ IDEA.
* User: arthur
* Date: 17/11/13
* Time: 22:26
@aembleton
aembleton / CookiesUtil.scala
Created Nov 18, 2013
Util for Play Cookies
View CookiesUtil.scala
package util
import play.api.mvc.{Cookie, Cookies}
/**
* Created with IntelliJ IDEA.
* User: arthur
* Date: 17/11/13
* Time: 22:26
* To change this template use File | Settings | File Templates.
View ArrayUtil.java
package uk.transactis.csvParsing.util;
public class ArrayUtil {
/**
* Trims all elements of an array without side affect.
*
* @param array
* Array from which to base the output array
* @return A new array that equals input array but with each element
@aembleton
aembleton / rename.bat
Created Oct 15, 2013
Renames files that have a name ending in 20131015-140115.csv to the current date in the format yyyyMMdd then a -, then the number already in the file name, incremented by 1. File ending in 20131015-140115.csv ran through this script on 1 January 2014 will have their ending renamed as 20130101-140116.csv
View rename.bat
@echo off
setlocal enabledelayedexpansion
set FOLDER_PATH=.
set year=%date:~-4%
set month=%date:~3,2%
set day=%date:~0,2%
pushd %FOLDER_PATH%
for %%f in (*csv) do if %%f neq %~nx0 (
set "filename=%%~nf"
set "postfix=!filename:~-6!"
@aembleton
aembleton / build.info
Last active Dec 25, 2015
Builds a jar
View build.info
#Sat, 12 Oct 2013 23:12:10 +0100
major=0
minor=1
build=3
You can’t perform that action at this time.