Skip to content

Instantly share code, notes, and snippets.

Always Be Shipping

Martin H. Normark martinnormark

Always Be Shipping
View GitHub Profile
martinnormark / BusinessLogicInstaller.cs
Created Jul 17, 2012
Castle Windsor IoC Container setup for ASP.NET MVC
View BusinessLogicInstaller.cs
using Castle.MicroKernel.Registration;
using Castle.MicroKernel.SubSystems.Configuration;
using Castle.Windsor;
using MyApp.BusinessLogic.Facades;
namespace MyApp.Web.PresentationLogic.Container
public class BusinessLogicInstaller : IWindsorInstaller
public void Install(IWindsorContainer container, IConfigurationStore store)
martinnormark /
Last active May 16, 2020
Create Azure Container Instance with SSH support.

Creating the container

environemnt vars to set:
NAME = Martin
SSHUSER = martin
SSHPWD = pwdnitram

command to run: [ "/bin/bash", "-c", "echo hello $NAME; tail -f /dev/null" ]

Configure SSH

Add a user

martinnormark / d3-mouse-over-line.js
Created Mar 22, 2016
Adding a vertical line to a D3 chart, that follows the mouse pointer.
View d3-mouse-over-line.js
var vertical =".chart")
.attr("class", "remove")
.style("position", "absolute")
.style("z-index", "19")
.style("width", "1px")
.style("height", "380px")
.style("top", "10px")
.style("bottom", "30px")
.style("left", "0px")
martinnormark / LogoView.swift
Created Apr 18, 2015
Swift enum to return ready-to-use UIImageView with a logo from asset library.
View LogoView.swift
import UIKit
enum LogoView : UIViewConvertible {
case Default()
case Large()
case Symbol()
// MARK: UIViewConvertible
var View: UIView {
switch self {
martinnormark / LoginViewController.swift
Created Dec 31, 2014
Correctly scaling a full size background image in iOS, to seamlessly transition from launch image
View LoginViewController.swift
override func viewDidLoad() {
self.view.backgroundColor = UIColor.whiteColor()
let screenSize: CGRect = UIScreen.mainScreen().bounds
var bgImage = UIImageView(image: UIImage(named: "login-bg")) = CGPointMake(self.view.bounds.size.width / 2, self.view.bounds.size.height / 2)
bgImage.transform = CGAffineTransformMakeScale(screenSize.width / 414, screenSize.height / 736)
martinnormark / DynamicHelper.cs
Created May 2, 2012
C# Dynamic extension methods for serializing to XML
View DynamicHelper.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using System.Xml;
using System.Xml.Linq;
/// <summary>
/// Extension methods for the dynamic object.
/// </summary>
martinnormark / fav-hashtag-tweets.js
Last active Jun 20, 2018
Twitter follow script
View fav-hashtag-tweets.js
__cnt__ = 0;
jQuery('.stream .js-actionFavorite').each(function(i, ele) { ele = jQuery(ele); if (ele.css('display') != 'inline-block') { return; } setTimeout(function() {; }, __cnt__++ * 500);
martinnormark / SearchSuggestionsAPI.cs
Created Sep 27, 2013
Simple C# API Client for the Google Search Suggestions API
View SearchSuggestionsAPI.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net.Http;
using System.Threading.Tasks;
using System.Xml.Linq;
namespace ConsoleApplication1
public class SearchSuggestionsAPI
martinnormark / BackgroundImageView.swift
Last active Dec 23, 2017
Full screen background view for iOS that adds blur and vibrancy effects.
View BackgroundImageView.swift
class BackgroundImageView : UIView {
private let bgImage = UIImageView(forAutoLayout: ())
private var blurView:UIVisualEffectView!
private var vibrancyView:UIVisualEffectView!
private var didSetupConstraints = false
var containerView: UIView? = nil {
willSet(container) {
martinnormark / other-bridges-above.xml
Created Mar 18, 2014
Overpass query to get all roads inside a bounding box, that is either a tunnel or has some kind of bridge above.
View other-bridges-above.xml
<osm-script output="json" timeout="25">
<!-- Bridges -->
<query type="way">
<has-kv k="bridge" regv="^(yes|viaduct)$"/>
<has-kv k="railway" modv="not" regv="." />
<bbox-query {{bbox}}/>
<!-- Find roads below the above bridges -->
You can’t perform that action at this time.