Skip to content

Instantly share code, notes, and snippets.

View adaam2's full-sized avatar

Adam Bull adaam2

View GitHub Profile
@adaam2
adaam2 / database_cleaner.rb
Created April 12, 2017 14:46 — forked from jsteiner/database_cleaner.rb
Database Cleaner
RSpec.configure do |config|
config.before(:suite) do
DatabaseCleaner.clean_with(:truncation)
end
config.before(:each) do
DatabaseCleaner.strategy = :transaction
end
config.before(:each, js: true) do
public interface IRepository<T> where T : class
{
T Find(int id);
List<T> All();
void Delete(int id);
void Update(T obj);
}
public class ProductRepository : IRepository<Product>
{
@adaam2
adaam2 / IRepository.cs
Last active July 23, 2018 12:49
Basic IRepository
public interface IRepository<T> where T : class
{
T Find(int id);
List<T> All();
void Delete(int id);
void Update(T obj);
}
@model Product
<h1>@Model.Name</h1>
{
"Name":"Stripey Socks",
"Slug":"stripey-socks",
"ShortDescription":"Get some stripes rawr",
"LongDescription":"Three separate boxes full of stripey socks delivered to your doorstep each month. The perfect gift for your Gran!",
"ProductShortCode":"GF",
"DespatchDayOfMonth":5,
"DeliveryDates":[
{
"Date":"2016-06-05T00:00:00",
@adaam2
adaam2 / mvc.txt
Last active April 26, 2016 13:59
MVC Practice.
Sample database connection string:
Data Source=mhknbn2kdz.database.windows.net;Initial Catalog=AdventureWorks2012;Integrated Security=False;User ID=sqlfamily;Password=sqlf@m1ly;Pooling=False
Things to touch on (in order)
1. Any questions / things that confuse you before starting)
2. Class libraries (adding references)

MB Dev Environment Setup

##Development Applications

  • Visual Studio 2015 Community Edition
  • SourceTree (if you don't want to use the command line. n.b. SSH keys are setup with SourceTree using Pageant / PuTTy)
  • Sublime Text 3
  • DbForge Studio for SQL Server (or SQL Server Management Studio 2014)
@adaam2
adaam2 / demo.js
Last active April 14, 2016 17:20
Flattening arrays (https://jsfiddle.net/vj6jvaxu/)
var arr = [[1,2,[3]],4];
// Call the method
var flattened = flatten(arr);
// Print the result out to the console..
console.log(flattened);
function flatten(arr) {
var flatArray = [];
@adaam2
adaam2 / README.md
Last active March 9, 2016 17:23
Shopify
// Establish new jQuery DataTables options object
$scope.dtOptions = DTOptionsBuilder.newOptions()
.withDOM('<<t>p>');