Skip to content

Instantly share code, notes, and snippets.

View edsilv's full-sized avatar

Edward Silverton edsilv

View GitHub Profile
@edsilv
edsilv / gist:4427c3b055a5573a96ca
Created January 27, 2015 14:55
Wellcome Player Wordpress Shortcode
// Add Shortcode: [player bnumber="b12345678" assetseq="0" asset="0" zoom="(get from address)"]
function player_shortcode( $atts ) {
$exatts = shortcode_atts( array (
'bnumber' => 'b18035978',
'assetseq' => '0',
'asset' => '0',
'zoom' => ''
), $atts);
//return '<h1>' . $exatts['bnumber'] . '</h1>';
return '<div class="wellcomePlayer" data-uri="http://wellcomelibrary.org/package/' . $exatts['bnumber'] . '" data-assetsequenceindex="' . $exatts['assetseq'] . '" data-assetindex="' . $exatts['asset'] . '" data-zoom="' . $exatts['zoom'] . '" data-config="/service/playerconfig" style="width: 100%; height: 420px; background-color: #000;"></div><script type="text/javascript" id="embedWellcomePlayer" src="http://wellcomelibrary.org/spas/player/build/wellcomeplayer/js/embed.js"></script>';
import ScaleTransform = Fayde.Media.ScaleTransform;
import TranslateTransform = Fayde.Media.TranslateTransform;
import TransformGroup = Fayde.Media.TransformGroup;
class Grid extends Fayde.Drawing.SketchContext {
// number of units to divide width by.
public _Divisor: number;
public ScaleToFit: boolean = false;
private _InitialUnitWidth: number;
@edsilv
edsilv / gist:5f40207ed75119b5eab5
Created February 1, 2015 17:55
extract svn .dump file
## use standard windows command prompt
cd C:\Program Files\SlikSvn\bin
mkdir c:\dumpRepo
svnadmin create c:\dumpRepo
type c:\myproject.dump | svnadmin load c:\dumpRepo
svn export file:///c:/dumpRepo c:\myproject
@edsilv
edsilv / gist:928254536732fe0918bd
Created March 9, 2015 10:54
Undo last commit
git reset --hard HEAD~1
@edsilv
edsilv / gist:8333a54ed65e6e25d533
Last active September 3, 2015 09:56
WebStorm "invalid config path" error
# in C:\Program Files (x86)\JetBrains\WebStorm 9.0.3\bin\idea.properties
# uncomment the following sections and set to:
#---------------------------------------------------------------------
# Uncomment this option if you want to customize path to IDE config folder. Make sure you're using forward slashes.
#---------------------------------------------------------------------
idea.config.path=C:/Users/[user]/.WebStorm10/config
#---------------------------------------------------------------------
# Uncomment this option if you want to customize path to IDE system folder. Make sure you're using forward slashes.
@edsilv
edsilv / gist:5180dfa4a0f48f177d00
Last active August 29, 2015 14:16
Add theme submodule to UV
git submodule add [email protected]:UniversalViewer/new-theme.git src/themes/new-theme
@edsilv
edsilv / gist:b2ce7df5917280557891
Created April 23, 2015 11:43
Disable git keyphrase
ssh-keygen -p
then enter an empty string
@edsilv
edsilv / gist:8a6ae7a370564f617e58
Created April 25, 2015 16:35
List git submodules
grep path .gitmodules | sed 's/.*= //'
@edsilv
edsilv / gist:4a45e99431da95fc3416
Last active August 29, 2015 14:22
HTML truncating algorithm

##Original HTML

<a>link one is really really long <img src="img.png" /></a>
<a>link two</a>
<a>link three</a>
<a>link four</a>

###Initialise

Parse the HTML into DOM elements.