Skip to content

Instantly share code, notes, and snippets.

@simme
simme / debounce-throttle.swift
Created December 20, 2016 10:04
Swift 3 debounce & throttle
//
// debounce-throttle.swift
//
// Created by Simon Ljungberg on 19/12/16.
// License: MIT
//
import Foundation
extension TimeInterval {
@jeremypruitt
jeremypruitt / sns-publish
Last active August 19, 2022 18:09
AWS Lambda function to publish to SNS topic
console.log('Loading function');
var AWS = require('aws-sdk');
AWS.config.region = 'us-west-2';
exports.handler = function(event, context) {
console.log("\n\nLoading handler\n\n");
var sns = new AWS.SNS();
sns.publish({
@tokyotech
tokyotech / NSNumber+conversion.m
Created March 11, 2015 17:02
Convert positive integer into Roman numerals
#import "NSNumber+conversion.h"
@implementation NSNumber (conversion)
- (NSString*)romanNumerals
{
assert(self.integerValue > 0);
static NSString* characterKey = @"c";
static NSString* valueKey = @"v";
@mutoo
mutoo / circumcircle.js
Last active November 17, 2022 15:54
a very fast algorithm for getting the circumcircle from a triangle - http://www.exaflop.org/docs/cgafaq/cga1.html#Subject 1.04
function circumcircle(a, b, c) {
this.a = a
this.b = b
this.c = c
var A = b.x - a.x,
B = b.y - a.y,
C = c.x - a.x,
D = c.y - a.y,
E = A * (a.x + b.x) + B * (a.y + b.y),