Gareth's Blog

Family Photo
Gareth,Rita and Reuben  

Live Reload Typesctipt et al

posted 10 Jul 2014, 13:00 by Gareth Rylance

THis is a live reload example gulp file used in a yo ko bower template. 

More refinements to follow

THanks to

function startExpress() {

    var express = require('express');
    var app = express();

var lr;
function startLiveReload() {

    lr = require('tiny-lr')();
function notifyLivereload(event) {

    // `` events provide an absolute path
    // so we need to make it relative to the server root
    var fileName = require('path').relative(__dirname, event.path);
    console.log('Live Reload...'+fileName);
        body: {
            files: [fileName]

// watch task
gulp.task('watch', function() {

    // Watch ts files'**/*.ts', function(event) {
        console.log('File ' + event.path + ' was ' + event.type + ', ts compile...');
    gulp.src([event.path, 'src/references.d.ts'],{base: './'})
                module: 'amd',
                sourcemap: true

    });['src/**/*.js','src/**/*.html','src/**/*.css' ], function(event) {
        console.log('File ' + event.path + ' was ' + event.type + ', running Live Reload...');



Git for configuration Management

posted 23 Jun 2014, 11:51 by Gareth Rylance

Create a hooks/post-receive in a bare git repository.

dir=the location of the repo
--work-tree=/etc/freeswitch/ the place to checkout the config to
git --work-tree=/etc/freeswitch/ --git-dir=/home/pi/repo/freeswitch.conf.git checkout -f

#Restart the service you just updated
service freeswitch restart

What to ignore in Webstorm .idea/?

posted 11 Feb 2014, 12:39 by Gareth Rylance

Directory based project format (.idea directory)

This format is used by all the recent IDE versions by default. Here is what you need to share:

  • All the files under .idea directory in the project root except the workspace.xml and tasks.xml files which store user specific settings
  • All the .iml module files that can be located in different module directories (applies to IntelliJ IDEA)

Be careful about sharing the following:

  • Android artifacts that produce a signed build (will contain keystore passwords)
  • dataSources.idsdatasources.xml (can contain database passwords)

You may consider not to share the following:

  • gradle.xml file, see this discussion
  • user dictionaries folder (to avoid conflicts if other developer has the same name)
  • XML files under .idea/libraries in case they are generated from Gradle project

IE8 Testing

posted 3 Feb 2014, 02:16 by Gareth Rylance

Microsoft provide virtual machines for testing older version of IE

Adding Programs to windows 8 search.

posted 18 Nov 2013, 23:36 by Gareth Rylance   [ updated 18 Nov 2013, 23:53 ]

Add a shortcut to your start menu.
Right click on required .exe. 
Click  Send To Desktop(create shortcut).
Then copy the shortcut to.
C:\Users\userName\AppData\Roaming\Microsoft\Windows\Start Menu

You can launch this short cut via the windows key search.

Ubuntu Network Interface Reset

posted 18 Dec 2012, 05:41 by Gareth Rylance

When using virtual machines (Hyper-V,Virtuabox) the mac address of the interface card presented to the OS may change and cause the interface name to increment (ethN -> ethN+1).

Deleting the line that contains the mac address in the file


should reset N.

TypeScript & Apphabor

posted 27 Oct 2012, 12:55 by Gareth Rylance   [ updated 28 Oct 2012, 00:10 ]

I recently learned about the hosting platform Appharbor and have been looking for a project to use it for. As mainly C# developer I have not had a reason or the time to properly explore JavaScript.The release of Typescript has lowered the barrier into the JavaScript world enough for to start to play.  I plan to post any interesting things I find here. 

The first thing I needed was somewhere to deploy any interesting code I write. This is were Apphabor comes in. A small change to the default TypeScript project will allow the project to be deployed into Apphabor. Apphabor does not know how to compile Typescript files into JavaScript so in order to use it for a TypeScript project you must add the  TypeScript compiler into your project and alter the default .csproj file to use it. 

The default location of the compiler is $(PROGRAMFILES)\Microsoft SDKs\TypeScript\\ I copied the TypeScript folder into my Visual studio solution directory. I then altered my .csproj file (by first unloading it) to use the copied compiler. The altered before build target is given below.

  <Target Name="BeforeBuild">
    <Exec Command="&quot;$(SolutionDir)TypeScript\\tsc&quot; @(TypeScriptCompile ->'&quot;%(fullpath)&quot;', ' ')" />

You must also add the created JavaScript files into you Visual Studio project and set them to be copied to the output directory on deployment. The files themselves do not need to be checked into source control as they will be generated from the TypeScript files.

With the above alterations a project checked into Apphabor will compile the TypeScript files and deploy the JavaScript files created. 

I think that is it but I will update this post if I missed anything.

1-7 of 7