Skip to content

Instantly share code, notes, and snippets.

View icholy's full-sized avatar
💥
breaking things

Ilia Choly icholy

💥
breaking things
View GitHub Profile
package rolling
import "gonum.org/v1/plot/plotter"
type XYs struct {
size int
start int
length int
data plotter.XYs
}
package ring
type T int
type Buffer struct {
data []T
size int
start int
filled int
}
package jira
import (
"crypto/tls"
"net/http"
"github.com/andygrunwald/go-jira"
)
var BaseURL = "https://jira.accipiterradar.com:8443"
/*
Copyright (c) 2019 DoorDash
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
@icholy
icholy / .md
Created May 30, 2019 15:30 — forked from faiface/.md
Go 2 generics counterproposal: giving up restricting types

Go 2 generics counterproposal: giving up restricting types

"I want to make a generic function which works on any type that satisfies these and these constraints."

When we think about generics, this is the sort of problem that pops up into our minds. The critical part is restricting the set of types our function intends to work on. Trying to solve this problem of restriction has led people to what I call reasons why we hesitate to have generics in Go.

C++ templates with horrific error messages, or even it's new concepts, Java's T extends Comparable<T>, Rust's generic traits, Haskell's type classes, and sadly even contracts from the [original generics proposal by the Go Team](https://go.googlesource.com/proposal/+/master/desig

#include <stdio.h>
#include <stdlib.h>
int main()
{
float dt = 0.5;
float prev_x = 0, prev_v = 0, a = 0.85, b = 0.005;
float input_x, state_v, diff_x;
@icholy
icholy / arith.go
Created November 10, 2018 23:44
Compile simple arithmetic expressions to x86 assembly
package main
import (
"fmt"
"strconv"
)
type Node interface {
String() string
}
@icholy
icholy / foo.c
Last active November 5, 2018 16:06
// we want to write a constructor function
// for this structure
typedef struct {
char* bar;
char* baz;
size_t baz_len;
} Foo;
@icholy
icholy / thing.css
Last active September 27, 2018 18:01
.button(
block,
className,
destructive,
disabled,
loading,
outline,
pill,
plain,
/**
* Same as joinPath, but preserves http(s):// schemes
*
* @param segments Url segments to join
* @return Joined url
*/
function joinUrl(...segments: string[]): string {
if (segments.length === 0) {
return "";
}