Skip to content

Instantly share code, notes, and snippets.

View stevefan1999-personal's full-sized avatar

Steve Fan stevefan1999-personal

View GitHub Profile
@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
@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.
@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.
@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
@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

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

@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).
@tkihira
tkihira / hack version.c
Created March 22, 2012 19:09
switch hack on C
void switch_func(int n) {
char *s;
switch(n) {
case 0:
s = "Sun";
if(0)
case 1:
{ s = "Mon"; }
if(0)
case 2:
1. Build GraphQL server using `express-graphql` package.
2. Configure `schema.js` file.
3. Query for data.
@LexManos
LexManos / clean.txt
Created December 8, 2018 20:06
1.13 Announcement.
So about 1.13. As we have been stating since the public release of 1.13,
the Forge update is a time we are taking to re-write everything from the
ground up. Not just Forge, but the entire toolchain, launcher, installer,
and core of Forge is being rewritten. Every line of code is being inspected,
and re-validated. This whole process takes a while. To give you (the reader)
an idea of what has been done so far:
ForgeGradle has been rewritten to support modern gradle versions, with better tools
to be expandable and used for more than just setting up a Minecraft/Forge
dependency project. It's also much cleaner and organized this time around