Skip to content

Instantly share code, notes, and snippets.

@toddb
toddb / userDefineLang_Gradle.xml
Created June 4, 2012 20:26
Gradle language for Notepad++
<NotepadPlus>
<UserLang name="Gradle" ext="gradle">
<Settings>
<Global caseIgnored="yes" />
<TreatAsSymbol comment="yes" commentLine="yes" />
<Prefix words1="no" words2="no" words3="no" words4="no" />
</Settings>
<KeywordLists>
<Keywords name="Delimiters">&quot;&apos;0&quot;&apos;0</Keywords>
<Keywords name="Folder+"></Keywords>
@toddb
toddb / build-tasks.ps1
Created August 9, 2011 06:34
Build tasks for powershell via psake
<#
Basic build tasks for SharePoint (or other projects) - using 7zip and GacUtil
$framework = '4.0x64'
. .\scripts\build-tasks.ps1
properties {
$project = "Sites"
define(['services/module', 'underscore'], function (module, _) {
'use strict';
function OrderResource($http, $q, link) {
// ... other functions removed: viewState, accessState, flattenResource
// viewState is a deeper resource
// accessState looks at the Accept headers
// flattenResource: flattens all of this for the client-side resource (in-memory model bound to view)
@toddb
toddb / markdown.gradle
Created June 5, 2012 09:58
Markdown script for usage of PegDown - converts md files into html
/*
* Adapted from https://raw.github.com/geb/geb-seconf-2012-slides/master/buildSrc/pegdown/src/main/groovy/org/gradle/plugins/pegdown/PegDown.groovy
*/
buildscript {
repositories {
mavenCentral()
}
dependencies {
@toddb
toddb / changelog.gradle
Created June 3, 2012 00:30
Gradle integration to SVN to generate CHANGELOG from svn log (integration via svnkit)
/*
task changeLog(type: ReleaseNotes){
destFile file("CHANGELOG-DJANGO-SAMPLE")
url "http://django-page-cms.googlecode.com/svn/trunk/"
}
# gradle changeLog
Creates output (first entry only shown):
@toddb
toddb / jasmine_extensions.js
Created April 11, 2012 20:02 — forked from esbie/jasmine_extensions.js
Jasmine spy syntactic sugar for dealing with success/error callbacks (aka jQuery.ajax)
/**
* An extension that always calls success when a spy is called.
*
* @example
* spyOn(foo, 'bar').andCallSuccessWith("baz");
* var options = {
* success: jasmine.createSpy();
* }
* foo.bar(options);
* expect(options.success).toBeCalledWith("baz");
@toddb
toddb / teamcity.pp
Created March 20, 2012 21:52
Puppet Teamcity script - straightforward, non-modularised & procedural
class teamcity {
@package{ [ "java-1.6.0-openjdk", "wget", "tar", "gzip" ]:
ensure => installed,
}
$src="http://download.jetbrains.com/teamcity/TeamCity-7.0.tar.gz"
$username="teamcity"
$installdir="/opt"
@toddb
toddb / gist:1474205
Created December 13, 2011 22:27 — forked from mathieul/gist:966776
Require files using RequireJS before running Jasmine specs
/**
* @license Copyright (c) 2012, toddb GoneOpen Limited.
* Available via the MIT or new BSD license.
* based on https://gist.github.com/966776 (mathieul) and forked to https://gist.github.com/1474205
* jasmine.requirejs() returns a function that will load the file(s) required
* and will wait until it's done before proceeding with running specs.
* The function returned is intended to be passed to beforeEach() so the file(s)
* is(are) loaded before running each spec.
*
@toddb
toddb / db-setup.psake.ps1
Created August 10, 2011 20:24
Use sql script for sharepoint in psake
Task Db-Setup -Description "Adds the current user for access to SharePoint schemas - DEV only" {
$userToAdd = Read-Host -Prompt 'User to add to Farm Admin group <DOMAIN>\<USERNAME>'
$db_env = Read-Host -Prompt 'Environment suffix of the database to setup'
Write-Host "If this script has a problem then you don't have login access - please sort this out first"
Write-Host "see http://www.sharepointassist.com/2010/01/29/the-local-farm-is-not-accessible-cmdlets-with-featuredependencyid-are-not-registered/"
$whoami = [Environment]::UserName
Write-Host "Adding dev user to database: $whoami"
Write-Host "Enter the password for the user $site_owner"
exec { sqlcmd -i .\dev-powershell-access.sql -U $whoami -v user=$userToAdd -v db_env=$db_env }
@toddb
toddb / update-host.psake.ps1
Created August 10, 2011 20:30
Update host file in psake
Property {
$domain = ""
}
Task Hostfile-Update -Description "Add new sites to the host file" {
$host_file = "$env:windir\System32\drivers\etc\hosts"
if ((Get-Content $host_file | ForEach-Object{$_ -eq "127.0.0.1 $domain "}) -notcontains "True")
{
Add-Content $host_file "`n127.0.0.1 $domain "
}