Skip to content

Instantly share code, notes, and snippets.

View mgechev's full-sized avatar
👷‍♂️
Making web development easier

Minko Gechev mgechev

👷‍♂️
Making web development easier
View GitHub Profile
@hediet
hediet / main.md
Last active March 11, 2024 15:05
Proof that TypeScript's Type System is Turing Complete
type StringBool = "true"|"false";


interface AnyNumber { prev?: any, isZero: StringBool };
interface PositiveNumber { prev: any, isZero: "false" };

type IsZero<TNumber extends AnyNumber> = TNumber["isZero"];
type Next<TNumber extends AnyNumber> = { prev: TNumber, isZero: "false" };
type Prev<TNumber extends PositiveNumber> = TNumber["prev"];
@njs50
njs50 / update-seed.js
Created June 2, 2016 13:22
shell script to update seed
#!/usr/bin/env node
var fs = require('fs');
var join = require('path').join;
var EDC_HOME = process.env.EDC_HOME;
var seedPath = join(EDC_HOME, 'angular2-seed');
@teropa
teropa / reactive2015_gol.md
Created September 24, 2015 15:56
ClojureScript Game of Life - Reactive 2015 Lightning Talk Proposal

In my proposed lightning talk for the Reactive Conference, I'll create Conway's Game of Life in ClojureScript, and I'll do it in five minutes. I'll use an interactive programming workflow enabled by Figwheel. Each piece will be added into the running application without reloading the page.

If you want to see a little cellular lifeform spawn out of nothing into an running web browser window, I'd appreciate it if you starred this Gist!

Cheers,

(@teropa)

@namit
namit / pre-commit
Last active August 29, 2015 14:18
Git pre-commit hook to deny commits in production branches and for files larger than a specified size
#!/usr/bin/env ruby
# (1) Prevent any commit to production branches
PRODUCTION_BRANCHES = ["production"]
branch = `git rev-parse --abbrev-ref=strict HEAD`.chomp
if (PRODUCTION_BRANCHES.include?(branch))
puts "\nDo you really want to commit on '#{branch}' branch?\nIf yes, add --no-verify to the commit command to force it."
@sebmarkbage
sebmarkbage / react-terminology.md
Last active January 9, 2023 22:47
React (Virtual) DOM Terminology
operator (<~) 49
{ $channel } => #{ yield csp.take($channel) }
operator (~>) 50 right
{ $value, $channel } => #{ yield csp.put($channel, $value) }
macro (<~alts) {
rule { } => {
yield csp.alts
}
@DanHerbert
DanHerbert / fix-homebrew-npm.md
Last active February 12, 2024 17:18
Instructions on how to fix npm if you've installed Node through Homebrew on Mac OS X or Linuxbrew

OBSOLETE

This entire guide is based on an old version of Homebrew/Node and no longer applies. It was only ever intended to fix a specific error message which has since been fixed. I've kept it here for historical purposes, but it should no longer be used. Homebrew maintainers have fixed things and the options mentioned don't exist and won't work.

I still believe it is better to manually install npm separately since having a generic package manager maintain another package manager is a bad idea, but the instructions below don't explain how to do that.

Fixing npm On Mac OS X for Homebrew Users

Installing node through Homebrew can cause problems with npm for globally installed packages. To fix it quickly, use the solution below. An explanation is also included at the end of this document.

@ept
ept / gist:4475995
Last active November 4, 2022 08:38
Syntax highlighting code for PowerPoint (Mac OS)

How to add syntax-highlighted code to PowerPoint slides (Mac OS)

  1. pygmentize -f rtf FILE | pbcopy
  2. Paste into TextEdit (in rich text mode: Format → Make Rich Text before pasting), and copy to clipboard again.
  3. In PowerPoint, Edit → Paste Special… → Styled Text.

(Pasting RTF directly into PowerPoint doesn't work correctly, at least with PowerPoint 2008 — it extends colour spans longer than it should, and sometimes removes line breaks. Going via TextEdit seems to solve the problem.)

@mgechev
mgechev / vimrc
Last active December 10, 2015 17:48
My vimrc.
"Sets nice colorscheme
colorscheme slate
"Starts the syntax
syntax on
"Sets smart indent
set smartindent
"Sets 4 spaces on tab
set tabstop=4
set shiftwidth=4
set expandtab
@briancavalier
briancavalier / promise-monad-proof.js
Created August 8, 2012 15:57
A proof that Promises/A is a Monad
//-------------------------------------------------------------
//
// Hypothesis:
//
// Promises/A is a Monad
//
// To be a Monad, it must provide at least:
// - A unit (aka return or mreturn) operation that creates a corresponding
// monadic value from a non-monadic value.
// - A bind operation that applies a function to a monadic value