Skip to content

Instantly share code, notes, and snippets.

View martinnormark's full-sized avatar
:shipit:
Always Be Shipping

Martin Høst Normark martinnormark

:shipit:
Always Be Shipping
View GitHub Profile
@martinnormark
martinnormark / PersistentRouterOutlet.ts
Created March 19, 2016 09:42 — forked from waeljammal/PersistentRouterOutlet.ts
Angular 2 Persistent Router
"use strict";
import * as hookMod from 'angular2/src/router/lifecycle/lifecycle_annotations';
import * as routerMod from 'angular2/src/router/router';
import {isBlank, isPresent} from 'angular2/src/facade/lang';
import {StringMapWrapper} from 'angular2/src/facade/collection';
import {Promise, PromiseWrapper} from 'angular2/src/facade/async';
import {BaseException} from 'angular2/src/facade/exceptions';
import {
ElementRef, DynamicComponentLoader, Directive, Injector, provide, ComponentRef, Attribute
@martinnormark
martinnormark / create_labels.sh
Last active August 29, 2015 14:26 — forked from omegahm/create_labels.sh
Create Gtihub labels from Bash
#!/usr/bin/env bash
# Colours picked from https://robinpowered.com/blog/best-practice-system-for-organizing-and-tagging-github-issues/
###
# Label definitions
###
declare -A LABELS
# Platform
@martinnormark
martinnormark / fav-hashtag-tweets.js
Last active June 20, 2018 12:46
Twitter follow script
__cnt__ = 0;
jQuery('.stream .js-actionFavorite').each(function(i, ele) { ele = jQuery(ele); if (ele.css('display') != 'inline-block') { return; } setTimeout(function() { ele.click(); }, __cnt__++ * 500);
});
@martinnormark
martinnormark / GrabGithubIssues.js
Created April 23, 2015 13:21
Grab list of Github issues currently selected
var issues = [];
$("input[type=checkbox].js-issues-list-check:checked").each(function() {
var $check = $(this),
$title = $check.parents("li.js-issue-row").find("a.issue-title-link");
issues.push($title.text().replace(/(\r\n|\n|\r)/gm,"").replace(/ /g, "") + " #" + $check.val())
})
window.prompt("Copy to clipboard: Ctrl+C, Enter", issues.join("\r\n"));
@martinnormark
martinnormark / LogoView.swift
Created April 18, 2015 13:14
Swift enum to return ready-to-use UIImageView with a logo from asset library.
import UIKit
enum LogoView : UIViewConvertible {
case Default()
case Large()
case Symbol()
// MARK: UIViewConvertible
var View: UIView {
switch self {
@martinnormark
martinnormark / mbxstyle.swift
Created March 27, 2015 23:34
Programmatically change map style in MapboxGL native with swift.
// Using SwiftyJSON
var path = NSBundle.mainBundle().pathForResource("satellite-v7-debug", ofType: "json")
var styles = NSData(contentsOfFile: path!)
var jsonStyles = JSON(data: styles!)
let polygonCoordinates = [
[
8.702266216278076,
56.04999222180692
@martinnormark
martinnormark / BackgroundImageView.swift
Last active August 2, 2022 09:42
Full screen background view for iOS that adds blur and vibrancy effects.
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) {
removeContainerViewFromSuperview()
@martinnormark
martinnormark / apn-feedback
Created January 22, 2015 22:45
Query the Apple Push Notification Feedback service using Houston (Nomad-CLI)
#!/usr/bin/env ruby
require 'houston'
certificate = 'cert.pem'
passphrase = ''
client = Houston::Client.production
client.certificate = File.read(@certificate)
client.passphrase = @passphrase
public static async Task<ZuMoLoginProviderCredentials> GetCurrentUser(this ApiController controller)
{
ServiceUser serviceUser = controller.User as ServiceUser;
if (serviceUser != null)
{
var identity = await serviceUser.GetIdentitiesAsync();
var credentials = identity.OfType<ZuMoLoginProviderCredentials>().FirstOrDefault();
return credentials;