Skip to content

Instantly share code, notes, and snippets.

View moander's full-sized avatar

moander moander

  • Norway
View GitHub Profile
@moander
moander / extendArrayProto.ts
Last active March 10, 2024 08:01
Lodash on Array.prototype
// eslint-disable
// Access prefixed lodash array functions on the Array prototype.
// For example [3,2,1].js1SortBy(x => x)
// https://gist.github.com/moander/c61c0e01027d7252a17f9d507985ac31
import type { Dictionary, ListIteratee, LoDashImplicitWrapper, Many, PropertyName, ValueIteratee, ValueIterateeCustom, ValueIteratorTypeGuard, Object as _Object } from 'lodash'
import {
chunk as js1Chunk,
@moander
moander / _worker.js
Last active March 10, 2024 07:59
_worker.js for pages api
/* eslint-disable */
/**
* Add _worker.js to your public directory to enable /api/* proxying
*
* env.API_ROUTER_URL
* Requests to /api/* is proxied to this url
*
* env.API_ROUTER_STRIP_PREFIX
* Remove this part from the beginning of pathname before proxying
@moander
moander / ThrowIfNullExtension.cs
Created August 13, 2016 16:53
whatever.ThrowIfNull(nameof(whatever));
namespace System
{
public static class ThrowIfNullExtension
{
// whatever.ThrowIfNull(nameof(whatever));
[System.Diagnostics.DebuggerStepThrough]
public static void ThrowIfNull<T>(this T o, string paramName)
where T : class
{
if (o == null)
@moander
moander / gist:e7ba2e9524f712008b398edca761dd0c
Last active May 12, 2016 20:57
Centos 7 Kubernetes Installer
yum install -y docker atomic kubernetes etcd
mkdir /etc/pki/kube-apiserver
openssl genrsa -out /etc/pki/kube-apiserver/serviceaccount.key 2048
sed -i.back '/KUBE_API_ARGS=*/c\KUBE_API_ARGS="--service_account_key_file=/etc/pki/kube-apiserver/serviceaccount.key"' /etc/kubernetes/apiserver
sed -i.back '/KUBE_CONTROLLER_MANAGER_ARGS=*/c\KUBE_CONTROLLER_MANAGER_ARGS="--service_account_private_key_file=/etc/pki/kube-apiserver/serviceaccount.key"' /etc/kubernetes/controller-manager