Skip to content

Instantly share code, notes, and snippets.

public class StopWatch {
private var elapsed: Double = 0
private var isRunning: Bool = false
private var startTime: Double = 0
public init() {}
public var elapsedTimeSeconds: Double {
if isRunning {
@texuf
texuf / ditto.py
Last active December 14, 2016 20:15
import unittest
from collections import defaultdict
'''
find_lines
ON^2 complexity find lines eq with ON space extra space complexity (not counting retval)
returns array of arrays of points
'''
def find_lines(points):
@texuf
texuf / TrieMap.cs
Created June 1, 2016 22:31
Immutable Trie Map in C#
using System;
using System.Collections.Generic;
namespace mastermind.core.immutable
{
public interface ITrieMap<K,V>
{
int GetHashCode(K key);
V this[K key] { get; }
@texuf
texuf / premailerfixup.py
Created April 4, 2015 04:02
fix for "WARNING Property: Unknown Property name." error from cssutils
from cssutils import profile
from cssutils.profiles import Profiles, properties, macros
#patch um up
properties[Profiles.CSS_LEVEL_2]['-ms-interpolation-mode'] = r'none|bicubic|nearest-neighbor'
properties[Profiles.CSS_LEVEL_2]['-ms-text-size-adjust'] = r'none|auto|{percentage}'
properties[Profiles.CSS_LEVEL_2]['mso-table-lspace'] = r'0|{num}(pt)'
properties[Profiles.CSS_LEVEL_2]['mso-table-rspace'] = r'0|{num}(pt)'
properties[Profiles.CSS_LEVEL_2]['-webkit-text-size-adjust'] = r'none|auto|{percentage}'
#re-add
profile.addProfiles([(Profiles.CSS_LEVEL_2,
openssl rsa -in ssl.key -out ssl.nopass.key
cat ssl.crt sub.class2.server.ca.pem ca.pem > concatenated.crt
heroku certs:update concatenated.crt ssl.nopass.key --app <APP_NAME>
@texuf
texuf / localeinfo.json
Last active August 29, 2015 13:57
json mapping language code to language name, taken from http://en.wikipedia.org/wiki/ISO_639-1_language_matrix
{
"ab":"Abkhazian",
"af":"Afrikaans",
"an":"Aragonese",
"ar":"Arabic",
"as":"Assamese",
"az":"Azerbaijani",
"be":"Belarusian",
"bg":"Bulgarian",
"bn":"Bengali",