Skip to content

Instantly share code, notes, and snippets.

View leon's full-sized avatar

Leon Radley leon

View GitHub Profile
@leon
leon / relate-2.0-swedish-lang.xml
Created June 21, 2011 07:30
Relate+ 2.0 Swedish translation
<?xml version="1.0" encoding="utf-8"?>
<languages>
<language name="Swedish" id="sv">
<pagetitles>
<images>bilder</images>
<imagegalleries>bildgallerier</imagegalleries>
<myblog>blogg</myblog>
<myfriends>vänner</myfriends>
<mypage>min sida</mypage>
</pagetitles>
@leon
leon / Property.cs
Created August 22, 2011 11:39
EPiServer Property usercontrol
using EPiServer.Core;
using EPiServer.Security;
using EPiServer.Web.PageExtensions;
using EPiServer.Web.PropertyControls;
using log4net;
using System;
using System.ComponentModel;
using System.Web.UI;
using System.Web.UI.WebControls;
namespace EPiServer.Web.WebControls
@leon
leon / playframework
Created October 15, 2011 19:14 — forked from domdorn/playframework
Upstart Script for the PlayFramework 1.x
# Upstart script for a play application that binds to an unprivileged user.
# put this into a file like /etc/init/playframework
# you can then start/stop it using either initctl or start/stop/restart
# e.g.
# start playframework
# http://dominikdorn.com
description "Description of your app"
author "Dominik Dorn <dominik@studyguru.eu>"
version "1.0"
@leon
leon / tomcat-on-ubuntu.md
Created November 30, 2011 14:36
Tomcat 7

Update

apt-get update

Install java

apt-get install sun-java6-jdk

Make sure java is available to ./configure otherwise it wont build

echo JAVA_HOME="/usr/lib/jvm/java-6-sun" >> /etc/environment
echo JRE_HOME="/usr/lib/jvm/java-6-sun/jre" >> /etc/environment
@leon
leon / rmate
Created December 15, 2011 07:42
Setup TextMate's ssh rmate function
#!/usr/bin/env ruby
# encoding: UTF-8
$VERBOSE = true # -w
$KCODE = "U" if RUBY_VERSION < "1.9" # -KU
require 'optparse'
require 'socket'
require 'fileutils'
@leon
leon / tracker.js
Created December 15, 2011 12:13
MooTools Analytics Tracker
/*
Monitors link clicks and pushes them to google analytics
It automatically tracks mail links and downloads, and if a link doesn't leed to the same domain it tracks it as an outbound link.
based on the drupalmodule http://drupalcontrib.org/api/drupal/contributions--google_analytics--googleanalytics.module
@author Leon Radley
Custom tracking example:
Tracker.track('download', 'customfile', 'mycustomfile');
*/
@leon
leon / ssh-copy-rsub
Created March 2, 2012 10:04
ssh-copy-rsub - allows you to easily copy the remote script to your server using the same syntax as ssh-copy-id
#!/bin/sh -e
#
# Usage: ssh-copy-rsub [--bash] [user@]machine
#
# Shell script to install rsub on the remove server so we can open shell scripts locally.
# Author: Leon Radley (http://github.com/leon)
URL="https://raw.github.com/avian/rmate/master/rmate"
if [ "$#" -gt 1 ] || [ "$1" = "-b" ] || [ "$1" = "--bash" ]; then
@leon
leon / ssh-copy-rmate
Created March 3, 2012 09:19
ssh-copy-rmate allows you to easily copy the remote script to your server using the same syntax as ssh-copy-id
#!/bin/sh -r
#
# Usage: ssh-copy-rmate [--bash] [user@]machine
#
# Shell script to install rmate on the remove server so we can open shell scripts locally.
# Author: Leon Radley (http://github.com/leon)
URL="https://raw.github.com/avian/rmate/master/rmate"
if [ "$#" -gt 1 ] || [ "$1" = "-b" ] || [ "$1" = "--bash" ]; then
@leon
leon / play.conf
Created March 26, 2012 12:27
Upstart script for Play Framework 2.0
# Upstart script for a play application that binds to an unprivileged user.
# put this into a file like /etc/init/play.conf
#
# This could be the foundation for pushing play apps to the server using something like git-deploy
# By calling service play stop in the restart command and play-start in the restart command.
#
# Usage:
# start play
# stop play
# restart play
@leon
leon / compile.scala
Created March 29, 2012 06:33
Compile scala programatically
import scala.tools.nsc.{Interpreter,Settings}
var i = new Interpreter(new Settings(str => println(str)))
var res = Array[Any](null)
i.beQuietDuring({
i.bind("result", "Array[Any]", res)
i.interpret("class Fred {def foo = 3}")
i.interpret("result(0) = new Fred")
})