Skip to content

Instantly share code, notes, and snippets.

View samwightt's full-sized avatar

Sam Wight samwightt

View GitHub Profile
@Gabriella439
Gabriella439 / trans.md
Last active November 28, 2023 06:30
I'm trans

I'm writing this post to publicly come out as trans (specifically: I wish to transition to become a woman).

This post won't be as polished or edited as my usual posts, because that's kind of the point: I'm tired of having to edit myself to make myself acceptable to others.

I'm a bit scared to let people know that I'm trans, especially because I'm not yet in a position where I can transition (for reasons I don't want to share, at least not in public) and it's really shameful. However, I'm getting really

@lblackstone
lblackstone / watch.ts
Created August 18, 2020 23:09
Use streamInvoke to watch k8s Event stream
import * as k8s from "@pulumi/kubernetes";
import { streamInvoke } from "@pulumi/pulumi/runtime";
import * as pulumi from "@pulumi/pulumi";
// Install the sealed secret controller.
new k8s.yaml.ConfigFile("sealed-secret-controller", {
file: "https://github.com/bitnami-labs/sealed-secrets/releases/download/v0.12.4/controller.yaml",
})
// Create a SealedSecret.
@ibarchenkov
ibarchenkov / stream_data_ecto_factory.ex
Created January 31, 2019 21:09
Elixir Ecto testing factories combined with StreamData generators.
defmodule MyApp.Factory do
use ExUnitProperties
alias MyApp.{Repo, User, Comment}
### Generators
def generator(:user) do
gen all name <- string(:alphanumeric, min_length: 2),
email <- generator(:email),
age <- integer(10..130) do
@trueadm
trueadm / adopt-syntax.js
Last active November 27, 2021 03:32
Adding a the "adopt" keyword to the JSX syntax
// I'm suggesting we add a new "adopt X from <Y />" syntax to the JSX language
// it would de-sugar to render prop children, but look and read better than
// what we currently have. For example:
// 1.
// this sugar
function MyComponent(props) {
adopt foo from <Bar />;
return <div>{foo}</div>;
}
@zz85
zz85 / greenlet.js
Last active June 17, 2019 20:52
Greenlet.js Annotated
// This is @zz85's attempt to understand and annotate the greenlet.js lib
// from https://github.com/developit/greenlet/blob/master/greenlet.js
/** Move an async function into its own thread.
* @param {Function} fn The (async) function to run in a Worker.
*/
export default function greenlet(fn) { // greenlet takes in a function as argument
let w = new Worker( // creates a web worker
URL.createObjectURL( // that has a local url
new Blob([ // created from a blob that has the following content

Why I hate TypeScript

Warning: These views are highly oppinated and might have some slightly incorrect facts. My experience with typescript was about 2 weeks in Node and a week in angular2.

Not Standard

TypeScript is implementing their own take on JavaScript. Some of the things they are writing will likely never make it in an official ES* spec either.

Technologies that have competing spec / community driven development have a history of failing; take: Flash, SilverLight, CoffeeScript, the list goes on. If you have a large code base, picking TypeScript is something your going to be living with for a long time. I can take a bet in 3 years JavaScript will still be around without a doubt.

Its also worth noting that they have built some things like module system and as soon as the spec came out they ditched it and started using that. Have fun updating!

@MikeDacre
MikeDacre / python.snippets
Last active June 29, 2024 18:15
UltiSnips: Add import to top of file with other imports
global !p
def first_blank_line():
""" Search current vim buffer for first blank line. If not found return current line """
b = snip.buffer
index = 0
break_index = 100
com_delim = re.compile(r'^(\s+)?(""")')
in_comment = False
for line in b:
index += 1