Skip to content

Instantly share code, notes, and snippets.

@tjchaplin
tjchaplin / gist:621edccbfddc0d3526b5
Created January 23, 2015 11:00
Update Teamcity Build Number based on package.json - (Powershell <= 2)
# These are project build parameters in TeamCity
# Depending on the branch, we will use different major/minor versions
[System.Reflection.Assembly]::LoadWithPartialName("System.Web.Extensions")
$ser = New-Object System.Web.Script.Serialization.JavaScriptSerializer
$json = Get-Content "package.json" | Out-String
$obj = $ser.DeserializeObject($json)
$majorVerion = ($obj['version'] -split "\.")[0]
$minorVerion = ($obj['version'] -split "\.")[1]
$buildCounter = "%teamcity.build.counter%"
$buildNumber = "$majorVerion.$minorVerion.$buildCounter"
@tjchaplin
tjchaplin / gist:8846073
Created February 6, 2014 15:13
Mongodb - Add BsonType information based on Convention
private static void RegisterBsonClassMappings()
{
//AnyBaseClass is defined as a root
BsonClassMap.RegisterClassMap<AnyBaseClass>(cm =>
{
cm.AutoMap();
cm.SetIsRootClass(true);
});
//IAnyInterface is a marker interface which falls in the inheritence tree for
@tjchaplin
tjchaplin / killNode.md
Created August 19, 2013 15:45
Kill Node App on remote server

#Kill node processes

##Kill all node processes

killall node 

##Kill specfic node process

@tjchaplin
tjchaplin / nodeAndBrowserFunction.js
Created July 16, 2013 22:23
Run method in node and in browser
(function(window){
"use strict";
console.log(window);
})(typeof global == 'object' && global || this);
{
"name": "sample",
"description": "A sample package",
"version": "0.0.0",
"author": "Tim Chaplin <tim.chaplin@ticktockdevelopment.com>",
"repository": {
"type": "git",
"url": "https://github.com/<SOMEPROJECTNAME>.git"
},
"homepage": "https://github.com/<SOMEPROJECTNAME>.git",
@tjchaplin
tjchaplin / sampleGruntConfiguration.js
Created June 29, 2013 07:40
A sample grunt configuration
module.exports = function(grunt) {
// configuration.
grunt.initConfig({
//Package file
pkg: grunt.file.readJSON("package.json"),
//jshint - configuration
jshint: {
files: ["gruntfile.js", "index.js", "lib/**/*.js","test/**/*.js"],
options: {
@tjchaplin
tjchaplin / GruntInstall
Created June 29, 2013 07:25
Getting Started With Grunt
//install grunt command line interface(CLI)
npm install -g grunt-cli
//install grunt into the projects modules
npm install grunt --save-dev
//install JSHint package
npm install grunt-contrib-jshint --save-dev
//install Watch configuration
[Interceptor(typeof(SimpleInterceptor))]
public class TestClass
{
public virtual void DoStuff()
{
//Do Important Stuff
}
}
Windsor.InitialiseCore();
Windsor.Container.Register(Component.For<IInterceptor>()
.ImplementedBy<SimpleInterceptor>());
public class SimpleInterceptor : IInterceptor
{
public void Intercept(IInvocation invocation)
{
invocation.Proceed();
}
}