Skip to content

Instantly share code, notes, and snippets.

View jakcharlton's full-sized avatar

Jak Charlton jakcharlton

View GitHub Profile
@jakcharlton
jakcharlton / tests.rb
Created October 26, 2010 03:21
Can't quite get this looking cleaner by using "subject" and "specify"
require 'spec_helper'
describe User, ".add_reputation via voting" do
before(:each) do
@user = User.new
@user.reputation.should == 1
end
it "adds one rep" do
@user.add_reputation(:voting)
1) DestinationsController GET index assigns all destinations as @destinations
Failure/Error: get :index
bad argument(expected URI object or URI string)
# ./spec/requests/destinations_controller.spec:14:in `block (3 levels) in <top (required)>'
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Threading;
using Dimebrain.TweetSharp.Extensions;
using Dimebrain.TweetSharp.Fluent;
using Dimebrain.TweetSharp.Model;
using NHibernate;
using NHibernate.Criterion;
@jakcharlton
jakcharlton / frag.js
Created May 23, 2011 03:26
How to turn to CoffeeScript
$(document).ready(function() {
$('.edit_area').editable('/fragments/1/save', {
loadurl : '/fragments/1/load_markup',
type : 'textarea',
cancel : 'Cancel',
submit : 'OK',
onblur : 'submit',
indicator : '<img src="/assets/rails.png">',
tooltip : 'Click to edit...'
});
@jakcharlton
jakcharlton / q.cs
Created May 25, 2011 06:48
EF mapping
public class Order
{
public int OrderId {get; private set;}
public List<Orderlines> Orderlines {get; private set;}
}
public class Orderline
{
public string Item {get; private set;}
public int Quantity {get;private set;}
@jakcharlton
jakcharlton / blerg.coffee
Created May 25, 2011 09:14
How do I return 'data' as the result of save_it ?
# How do I return 'data' as the result of save_it ?
save_it = (edited_value, s) ->
$.post(url_to_save_to, {value: edited_value}, (data) -> data)
@jakcharlton
jakcharlton / timeit.cs
Created June 7, 2011 04:17
A quick and simple timer class to wrap
using (new TimeIt()) { command.Execute(); }
public class TimeIt : IDisposable
{
private readonly TextWriter output;
private readonly Stopwatch watch;
public TimeIt() : this(Console.Out) {}
public TimeIt(TextWriter output)
@jakcharlton
jakcharlton / blah
Created June 8, 2011 05:32
Failed FluentMigrator with CE
Using Database SqlServerCe and Connection String Data Source=Database1.sdf
BUILD FAILED
INTERNAL ERROR
System.Data.SqlServerCe.SqlCeException: Unable to load the native components of SQL Server Compact corresponding to the ADO.NET provider of version 84
82. Install the correct version of SQL Server Compact. Refer to KB article 974247 for more details.
at System.Data.SqlServerCe.NativeMethods.LoadNativeBinaries()
at System.Data.SqlServerCe.SqlCeConnection..ctor()
Buildfile: file:///C:/dev2/fmce/src/FluentMigrator.Example/example-nant.build
Target framework: Microsoft .NET Framework 3.5
Target(s) specified: migrate
[loadtasks] Scanning assembly "FluentMigrator.NAnt" for extensions.
migrate:
Using Database SqlServerCe and Connection String Data Source=Database1.sdf
-- Beginning Transaction
CanCreateTable : FailedSetUp : System.BadImageFormatException : is not a valid Win32 application. (Exception from HRESULT: 0x800700C1)
TearDown : System.NullReferenceException : Object reference not set to an instance of an object.
at System.Runtime.InteropServices.Marshal.ThrowExceptionForHRInternal(Int32 errorCode, IntPtr errorInfo)
at System.Data.SqlServerCe.UnmanagedLibraryHelper..ctor(String fileName)
at System.Data.SqlServerCe.NativeMethodsHelper..ctor(String modulePath)
at System.Data.SqlServerCe.NativeMethods.LoadValidLibrary(String modulePath)
at System.Data.SqlServerCe.NativeMethods.LoadNativeBinariesFromPrivateFolder(String privateInstall)
at System.Data.SqlServerCe.NativeMethods.LoadNativeBinaries()
at System.Data.SqlServerCe.SqlCeEngine..ctor()
at System.Data.SqlServerCe.SqlCeEngine..ctor(String connectionString)