Skip to content

Instantly share code, notes, and snippets.

loaders: [
{
test: /\.(png|jpg|gif)$/,
loader: 'url-loader?limit=8192'
},
{
test: /\.woff(\?v=\d+\.\d+\.\d+)?$/,
loader: 'url?mimetype=application/font-woff'
}, {
test: /\.woff2(\?v=\d+\.\d+\.\d+)?$/,
@b1ff
b1ff / test.js
Created April 18, 2016 09:16
Webpack configuration for unit-tests using Jasmine and Enzyme.
'use strict';
const webpack = require('webpack');
let path = require('path');
let srcPath = path.join(__dirname, '/../src/');
let baseConfig = require('./base');
module.exports = {
devtool: 'inline-source-map',
module: {
@b1ff
b1ff / Component.ts
Last active November 25, 2015 06:59
A OO wrapper for Angular directives. Encapsulates best practises.
// utility
export function mapToAngular(comp: new() => Component) {
return function dirFactory($injector) {
var instance = $injector.instantiate(comp);
return {
templateUrl: instance.templateUrl,
controller: () => instance,
controllerAs: 'vm',
bindToController: true,
scope: instance.binding,
[Fact]
public void user_context_should_be_registered_per_dependency_scope()
{
EnsurePerScopeLifetime<IUserContext>();
}
private static void EnsurePerScopeLifetime<T>()
where T: class
{
public class Test
{
private Fixture fixture;
private IRepository sut;
public Test()
{
fixture = new Fixture(); // with some configuration
sut = fixture.Freeze<IRepository>();
}
[AllowAnonymous]
public class AuthenticationController: ApiController
{
private readonly IFormsAuthWrapper _formsAuth;
public AuthenticationController(IFormsAuthWrapper formsAuth)
{
_formsAuth = formsAuth;
}
public interface IFormsAuthWrapper
{
FormsAuthenticationTicket Decrypt(string value);
string GetAuthToken(string username, bool persist);
}
public class FormsAuthWrapper : IFormsAuthWrapper
{
private const int SessionTimeout = 300;
[TestFixture]
public class FormsAuthenticationFilterTests
{
private class TestController : ApiController
{
[AllowAnonymous]
public void PublicMethod()
{
}
@b1ff
b1ff / chosen.jquery
Created November 26, 2013 13:00
chosen
// Chosen, a Select Box Enhancer for jQuery and Prototype
// by Patrick Filler for Harvest, http://getharvest.com
//
// Version 1.0.0
// Full source at https://github.com/harvesthq/chosen
// Copyright (c) 2011 Harvest http://getharvest.com
// MIT License, https://github.com/harvesthq/chosen/blob/master/LICENSE.md
// This file is generated by `grunt build`, do not edit it by hand.
(function() {
// Internal recursive comparison function for `isEqual`.
var eq = function(a, b, aStack, bStack) {
// Identical objects are equal. `0 === -0`, but they aren't identical.
// See the Harmony `egal` proposal: http://wiki.ecmascript.org/doku.php?id=harmony:egal.
if (a === b) return a !== 0 || 1 / a == 1 / b;
// A strict comparison is necessary because `null == undefined`.
if (a == null || b == null) return a === b;
// Unwrap any wrapped objects.
if (a instanceof _) a = a._wrapped;
if (b instanceof _) b = b._wrapped;