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 / SearchSuggestionsAPI.cs
Created September 27, 2013 10:39
Simple C# API Client for the Google Search Suggestions API
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
martinnormark / updateConstraints.swift
Last active September 23, 2020 08:56
Example of updateConstraints using PureLayout
private var didUpdateConstraints: Bool = false
override func updateConstraints() {
if (!didUpdateConstraints) {
self.buildStatusIndicatorView.autoPinEdgesToSuperviewEdgesWithInsets(UIEdgeInsetsZero, excludingEdge: ALEdge.Trailing)
self.buildStatusIndicatorView.autoSetDimension(ALDimension.Width, toSize: 10)
self.buildNumberLabel.autoPinEdgesToSuperviewEdgesWithInsets(UIEdgeInsets(top: 5, left: 15, bottom: 5, right: 5), excludingEdge: ALEdge.Bottom)
self.buildNumberLabel.autoSetDimension(ALDimension.Height, toSize: 23)
@martinnormark
martinnormark / aci-create.md
Last active May 16, 2020 09:55
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
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 / 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 / other-bridges-above.xml
Created March 18, 2014 00:28
Overpass query to get all roads inside a bounding box, that is either a tunnel or has some kind of bridge above.
<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}}/>
</query>
<!-- Find roads below the above bridges -->
@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
@martinnormark
martinnormark / MailgunUploadController.cs
Last active October 5, 2017 22:17
Receive e-mails from Mailgun routes in ASP.NET MVC
using System;
using System.IO;
using System.Web;
using System.Web.Mvc;
namespace WebApp
{
public class MailgunUploadController : Controller
{
//
@martinnormark
martinnormark / jquery.validate.unobtrusive.dynamic.js
Created January 11, 2013 22:41
Dynamically parse new validation rules on DOM elements
(function ($) {
$.validator.unobtrusive.parseDynamic = function (selector) {
//use the normal unobstrusive.parse method
$.validator.unobtrusive.parse(selector);
//get the relevant form
var form = $(selector).first().closest('form');
if (!form.length) {
form = $(selector).first().find('form');
@martinnormark
martinnormark / .gitignore
Created August 13, 2017 22:28 — forked from FullStackForger/.gitignore
.gitignore for Unity3d project
###
# Unity folders and files
###
[Aa]ssets/AssetStoreTools*
[Bb]uild/
[Ll]ibrary/
[Ll]ocal[Cc]ache/
[Oo]bj/
[Tt]emp/
[Uu]nityGenerated/