Skip to content

Instantly share code, notes, and snippets.

View stevefan1999-personal's full-sized avatar

Steve Fan stevefan1999-personal

View GitHub Profile
@dead-claudia
dead-claudia / constraint-types.md
Last active October 3, 2022 19:31
TypeScript Constraint Types Proposal

(All feedback/discussion should take place in the relevant issue.)

TypeScript Constraint Types Proposal

There's multiple requests for the ability to control a type at a much more fine grained level:

  • #12424: Mapped conditional types
  • #12885: Typing function overloads
  • #12880: Bad inference for lambda closures
  • Promises wrongfully accept thenables as their generic parameter (thenables can never be the argument to a then callback).

I have been an aggressive Kubernetes evangelist over the last few years. It has been the hammer with which I have approached almost all my deployments, and the one tool I have mentioned (shoved down clients throats) in almost all my foremost communications with clients, and it was my go to choice when I was mocking my first startup (saharacluster.com).

A few weeks ago Docker 1.13 was released and I was tasked with replicating a client's Kubernetes deployment on Swarm, more specifically testing running compose on Swarm.

And it was a dream!

All our apps were already dockerised and all I had to do was make a few modificatons to an existing compose file that I had used for testing before prior said deployment on Kubernetes.

And, with the ease with which I was able to expose our endpoints, manage volumes, handle networking, deploy and tear down the setup. I in all honesty see no reason to not use Swarm. No mission-critical feature, or incredibly convenient really nice to have feature in Kubernetes that I'm go

@darklight721
darklight721 / INSTRUCTIONS.md
Last active December 7, 2020 12:57
Using MobX with decorators in React Native

Using MobX with decorators in React Native

The following instructions should work with React Native v0.32:

  1. Install mobx libraries.

    npm install mobx --save
    npm install mobx-react --save
@elcritch
elcritch / rancher-zerotier.yml
Last active July 24, 2019 13:12
Run ZeroTier on RancherOS
#cloud-config
rancher:
services:
zerotier:
image: zerotier/zerotier-containerized:1.2.4
labels:
io.rancher.os.scope: system
volumes:
- /var/lib/zerotier-one:/var/lib/zerotier-one
restart: always
@puffnfresh
puffnfresh / overloading.js
Created September 6, 2012 00:55
Operator overloading in JavaScript
// This file shows a hack to achieve operator overloading in
// JavaScript. I have defined 3 different operators:
//
// >= = monadic bind
// >> = kleisli composition
// > = functor map
// * = applicative apply
// + = semigroup append
//
// Head straight to the bottom to see example usages.
@cslarsen
cslarsen / palindrome-linear.cpp
Created March 2, 2011 19:56
Linear scan for palindromes
/*
* Find the longest palindrome in the text.
*
* This is Greplin's first challenge, and I originally solved it in Python.
*
* This algorithm is linear on the average input, but has a quadratic
* worst case running time. There exists an even better algorithm, but
* this should do.
*
* There might also be a small error below, but you get the general idea.
@sasq64
sasq64 / func.cpp
Last active October 1, 2017 08:16
C++ Type erased dispatch - or whatever
#include <cstdio>
#include <functional>
#include <string>
#if __cplusplus <= 201200L
namespace std {
// index_sequence