Skip to content

Instantly share code, notes, and snippets.

@keithbloom
keithbloom / example1.js
Created October 30, 2011 14:41
WonderfulBackboneJS
$(function() {
// 1
window.ShoppingItem = Backbone.Model.extend({
constructor: function () {
if (!this.collection) {
this.collection = Products;
}
},
defaults: {
@keithbloom
keithbloom / example1.js
Created October 30, 2011 14:33
ExtendingTheJavaScriptArray
var domainNameParts = “www.keithbloom.co.uk”.split(‘.’); // returns [‘www’,’keithbloom’,’co’,’uk’]
var subDomains = [‘www’,’landingpages’,’uk’];
@keithbloom
keithbloom / example1.cs
Created October 30, 2011 09:32
AddTheSequenceNumberToALinqQuery
var lines = new[]
{
"Line A",
"Line B",
"Line C"
};
var dict = new Dictionary<string, string>();
for(int i=0; i <= lines.GetUpperBound(0); i++)
@keithbloom
keithbloom / example1.cs
Created October 30, 2011 08:00
NAntDotNet4Error
Unhandled Exception: System.TypeInitializationException:
The type initializer for 'NAnt.Console.ConsoleStub' threw an exception.
System.Security.SecurityException: Request for the permission of type
'System.Security.Permissions.FileIOPermission, mscorlib, Version=4.0.0.0'
@keithbloom
keithbloom / example1.sh
Created October 30, 2011 07:48
SharedPicasaLibrary
~/Library/Application Support/Google/Picasa/db3/
@keithbloom
keithbloom / example1.ps
Created October 30, 2011 07:37
ReadingEventLogFromPowerShell
$e = get-wmiobject -computerName 'SERVER' -query "SELECT * FROM Win32_NTLogEvent WHERE (logfile='application') AND (type='warning')"
@keithbloom
keithbloom / example1.cs
Created October 30, 2011 07:14
SeleniumVisualStudio
[TestFixture]
public class BasicTests : SeleniumRunner
{
protected override string ProjectName
{
get { return "Selenium.Example.WebSite"; }
}
}
@keithbloom
keithbloom / example1.asp
Created October 30, 2011 07:10
PreExecuteScriptErrors
WriteToFile "C:\Websites\PreExecute\Logs\PreExecuteErrors_" & Year(Now) & Month(Now) & Day(Now) & _
".html", " Date/Time: " & Now() & "<br />" & _
" ASP Code: " & objASPError.ASPCode & "<br />" & _
"ASP Description: " & objASPError.Description & "<br />" & _
" Category: " & objASPError.Category & "<br />" & _
" Column: " & objASPError.Column & "<br />" & _
" Description: " & objASPError.Description & "<br />" & _
" File: " & objASPError.File & "<br />" & _
" Line: " & objASPError.Line & "<br />" & _
" Number: " & objASPError.Number & "<br />" & _
@keithbloom
keithbloom / example1.ps
Created October 30, 2011 07:03
DeleteFilesContainingAString
$list = gci C:\Website\isc\* -include "*.aspx" -recurse | select-string -pattern "/user_controls/OldControl.ascx"
$list | foreach { rm $_.Path }
@keithbloom
keithbloom / example1.ps
Created October 28, 2011 21:11
3ReasonsForUsingPowershell
set-location \\\\servername\sharename