Skip to content

Instantly share code, notes, and snippets.

#!/usr/bin/env bash
# This script is intended to create a sentry release and upload build artefacts
# so we can get better error messages with the sourcemaps and such.
#
# https://docs.sentry.io/clients/javascript/sourcemaps/#uploading-source-maps-to-sentry
#
organization=false
project=false
#include <iostream>
using namespace std;
int main(int argc, const char *argv[]) {
double n = 3;
double result = 1;
double multiplier = -1;
for (int approximations = 0; approximations < 10000; approximations++) {
@tominated
tominated / ajaxtest.roy
Created March 3, 2014 01:18
Fiddling around improving the example ajax monad on the roy homepage
type Request = {url: String, payload: String}
data Response =
Success Number String | Error Number String
let ajaxRequest = {
return: \x -> x
bind: \(x : Request) f ->
let r = $.get x.url x.payload
r.done (\d s -> f (Success s d))
r.fail (\d s -> f (Error s d))
data Measurement =
Centimetres Number | Inches Number
let toInches (x: Measurement) = match x
case (Inches _) = x
case (Centimetres y) = Inches (y / 2.54)
let printMeasurement (x: Measurement) = match x
case (Inches n) = console.log n "inches"
case (Centimetres n) = console.log n "cm"
@tominated
tominated / gist:9128665
Last active August 29, 2015 13:56
Just watched Jim Weirich's talk on y-combinators and wanted to try it myself. Rest in peace.
;; Recursive anonymous functions!
(defn y-combinator
[f]
((fn [x] (f (fn [v] ((x x) v))))
(fn [x] (f (fn [v] ((x x) v))))))
;; Factorial function using the y-combinator
(def fact
(y-combinator
(fn [partial]
@tominated
tominated / gist:8216236
Last active January 1, 2016 23:19
Basic motor control using an RC receiver with a Baby Orangutan robot controller
#include <pololu/orangutan.h>
#define RIGHT_STICK_V 0
#define RIGHT_STICK_V_MIN 3000
#define RIGHT_STICK_V_MAX 4500
#define LEFT_STICK_V 1
#define LEFT_STICK_V_MIN 3000
#define LEFT_STICK_V_MAX 4500
myAngularApp.directive('imgLoadStatus', [
'$q',
'$timeout',
function($q, $timeout){
return {
restrict: 'A',
link: function(scope, element, attrs) {
scope.imagesLoaded = false;
// Having this in a timeout sucks, but it won't work without it