Skip to content

Instantly share code, notes, and snippets.

@CallumVass
CallumVass / gist:7391124
Created November 9, 2013 22:52
Error with Oak and Nancy Insert
public class Bootstrapper : DefaultNancyBootstrapper
{
protected override void ConfigureApplicationContainer(TinyIoCContainer container)
{
container.Register(new Customers());
}
}
public class Customers : DynamicRepository
{
@CallumVass
CallumVass / gist:8300400
Last active January 2, 2016 11:59
Hacky way to load the correct service for before/after save operations to provide additional validation / business logic to entities for Breeze JS
public class SalesAppContextProvider : EFContextProvider<SalesAppContext>
{
private readonly ServiceFactory _serviceFactory;
public SalesAppContextProvider(ServiceFactory serviceFactory)
{
_serviceFactory = serviceFactory;
}
protected override bool BeforeSaveEntity(EntityInfo entityInfo)
PHP:
<?
session_start();
if(isset($_POST['submitted'])) {
$name = trim($_POST['name']);
$phone = trim($_POST['phone']);
$email = trim($_POST['email']);
$comment = trim($_POST['comment']);
@CallumVass
CallumVass / Bootstrapper
Created March 13, 2014 15:12
Error: No registration for type IQueryHandler<EnrollmentDateQuery, List<EnrollmentDateGroup>> could be found.
container.RegisterSingle<IQueryProcessor, DynamicQueryProcessor>();
container.RegisterManyForOpenGeneric(typeof(IQueryHandler<,>), Assembly.GetExecutingAssembly());
@CallumVass
CallumVass / Currently Generated
Created April 11, 2014 07:37
Yeoman Angular Generator
app.js:
'use strict';
angular.module('yeomanTestApp', [
'ngCookies',
'ngResource',
'ngSanitize',
'ngRoute'
])
@CallumVass
CallumVass / structure
Created July 24, 2014 08:53
Typical Angular Project Structure
|-- app.js
|-- common/
| |-- common.js
| |-- directives/
| | |-- someCommonDirective.js
| | |-- someOtherCommonDirective.js
|-- customers/
| |-- customerList.js
| |-- customerList.html
| |-- customerCreate.js
"use strict";
require("angular");
require("angular-route");
var home = require("./controllers/home");
var testService = require("./services/testService");
angular.module("app", ["ngRoute"])
.config(function ($routeProvider) {
$routeProvider.when("/", {
time1 will return the time the server started and won't change, ie will always be 27/06/2020 18:16:59
time2 will work as I expected it to work, showing the current time the page was loaded
module Nav
open Feliz
open Feliz.Router
let nav =
let logo () = StaticFile.import "./imgs/logo.png"
Html.aside [ prop.className "relative bg-blue-700 lg:self-stretch lg:w-64 w-full shadow-xl flex flex-col"
prop.children [ Html.div [ prop.className "p-6 flex justify-between"
prop.children [ Html.a [ prop.href "/"
@CallumVass
CallumVass / Result.ts
Created September 17, 2020 14:22
TS/F#
export interface ErrorValue {
ErrorValue: string;
}
export interface ResultValue<T> {
ResultValue: T;
}
export interface ErrorResult {
Case: "Error";