Skip to content

Instantly share code, notes, and snippets.

View GeertVL-zz's full-sized avatar
💭
Working full time in Azure technologies

Geert Van Laethem GeertVL-zz

💭
Working full time in Azure technologies
View GitHub Profile
angular.module('myApp.controllers', []).
controller('MyCtrl1', ['$scope', function($scope) {
$scope.uploadFile = function() {
console.log("Uploading file");
for (var i = 0, f; f = $scope.files[i]; i++) {
var reader = new FileReader();
reader.onloadend = function(evt) {
if (evt.target.readyState == FileReader.DONE) {
console.log(evt.target.result);
}
$scope.filesPortfolio = {
id:0,
idName:"Documents",
number:"1",
name:"Documents",
files:[
{id:0,type:"image",title:"Brochure Cooling", image:"thumb0.png"},
{id:1,type:"image",title:"Cooling systems", image:"thumb1.jpg"},
{id:2,type:"image",title:"Transport systems", image:"thumb2.jpg"},
{id:3,type:"video",title:"Long distance transport", image:"thumb3.jpg"},
'use strict';
/* Filters */
angular.module('myApp.filters', []).
filter('interpolate', ['version', function(version) {
return function(text) {
return String(text).replace(/\%VERSION\%/mg, version);
};
}]).
// The SqlEntityConnection (Entity Data Model) TypeProvider allows you to write code that uses
// a live connection to a database that is represented by the Entity Data Model. For more information,
// please go to
// http://go.microsoft.com/fwlink/?LinkId=229210
module GeertVLConnection
#if INTERACTIVE
#r "System.Data"
#r "System.Data.Entity"
@GeertVL-zz
GeertVL-zz / gist:f5f80f3ada31417e3dbc
Created April 6, 2015 16:30
BDD with only XUnit
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Xunit;
namespace Specs.Registration
{
public enum UserStatus
public class Guest : UntypedActor
{
private IActorRef _receptionist;
public Guest()
{
var receptionist = Context.ActorSelection("/user/Klara");
receptionist.Tell(new Identify("111"), Self);
}
Object.extend(Number.prototype, (
function() {
function succ() {
return this + 1;
}
function times(iterator, context) {
$R(0, this, true).each(iterator, context);
return this;
}
// shortened to fit on this slide!
// Part 1.
// Implement a function prototype extension that caches function results for
// the same input arguments of a function with one parameter.
//
// For example:
// Make sin(1) have the result of Math.sin(1), but use a cached value
// for future calls.
//
// Part 2.
// Use this new function to refactor the code example.
<script>
var Person = function(name) {
this.name = name;
this.getName = function() {
return this.name;
};
}
var thomas = new Person('Thomas');
var amy = new Person('Amy');
<script>
// Part 1
// Implement a function prototype extension that caches function results for
// the same input arguments of a function with one parameter.
Function.prototype.withCaching = function withCaching() {
if (!this.cache) { this.cache = {}; }
var method = this;
return function(input) {
if (typeof method.cache[input] == "undefined") {