Skip to content

Instantly share code, notes, and snippets.

View robinpokorny's full-sized avatar

Robin Pokorny robinpokorny

View GitHub Profile
@danieleggert
danieleggert / GPG and git on macOS.md
Last active May 3, 2024 12:26
How to set up git to use the GPG Suite

GPG and git on macOS

Setup

No need for homebrew or anything like that. Works with https://www.git-tower.com and the command line.

  1. Install https://gpgtools.org -- I'd suggest to do a customized install and deselect GPGMail.
  2. Create or import a key -- see below for https://keybase.io
  3. Run gpg --list-secret-keys and look for sec, use the key ID for the next step
  4. Configure git to use GPG -- replace the key with the one from gpg --list-secret-keys
@dergachev
dergachev / GIF-Screencast-OSX.md
Last active May 2, 2024 05:55
OS X Screencast to animated GIF

OS X Screencast to animated GIF

This gist shows how to create a GIF screencast using only free OS X tools: QuickTime, ffmpeg, and gifsicle.

Screencapture GIF

Instructions

To capture the video (filesize: 19MB), using the free "QuickTime Player" application:

@jimbojsb
jimbojsb / gist:1630790
Created January 18, 2012 03:52
Code highlighting for Keynote presentations

Step 0:

Get Homebrew installed on your mac if you don't already have it

Step 1:

Install highlight. "brew install highlight". (This brings down Lua and Boost as well)

Step 2:

@yang-wei
yang-wei / destructuring.md
Last active February 20, 2024 04:40
Elm Destructuring (or Pattern Matching) cheatsheet

Should be work with 0.18

Destructuring(or pattern matching) is a way used to extract data from a data structure(tuple, list, record) that mirros the construction. Compare to other languages, Elm support much less destructuring but let's see what it got !

Tuple

myTuple = ("A", "B", "C")
myNestedTuple = ("A", "B", "C", ("X", "Y", "Z"))
@mpj
mpj / classless.md
Last active November 13, 2023 16:34

The future is here: Classless object-oriented programming in JavaScript.

Douglas Crockford, author of JavaScript: The Good parts, recently gave a talk called The Better Parts, where he demonstrates how he creates objects in JavaScript nowadays. He doesn't call his approach anything, but I will refer to it as Crockford Classless.

Crockford Classless is completely free of class, new, this, prototype and even Crockfords own invention Object.create.

I think it's really, really sleek, and this is what it looks like:

function dog(spec) {
@robinpokorny
robinpokorny / uuid4to7.js
Created April 26, 2023 10:40
Convert UUID v4 to v7 in JavaScript (or generate one)
const uuid4to7 = (uuid, now = Date.now()) => {
const ts = now.toString(16).padStart(12, `0`)
return `${ts.slice(0, 8)}-${ts.slice(8)}-7${uuid.slice(15)}`
}
// generate new UUIDv7
uuid4to7(crypto.randomUUID())
// Conforms to example in the spec RFC4122bis C.6
@mbohun
mbohun / example.md
Last active March 13, 2023 20:06
simple BASH/curl scipt for github REST API (HTTP GET queries)
$ ./githubapi-get.sh $GITHUBTOKEN /users/mbohun/repos
HTTP/1.1 200 OK
Server: GitHub.com
Date: Wed, 04 Mar 2015 04:30:29 GMT
Content-Type: application/json; charset=utf-8
Content-Length: 155683
Status: 200 OK
@robinpokorny
robinpokorny / railway_oriented_typescript.ts
Created November 3, 2022 08:47
Heapcon 2022: Railway Oriented Typescript
/*
=============================
Railway Oriented Typescript
=============================
by @robinpokorny
*/
/* === 1. Union basics === */
const a: string | number = 42;
@infertux
infertux / mirror-github.sh
Last active August 12, 2022 09:07
A little Bash script to make a mirror of your Github repositories and keep them up-to-date.
#!/bin/bash
# A little Bash script to make a mirror of your Github repositories and keep
# them up-to-date.
# Why mirroring? Because I can!
# Also, it will be very useful if one day a meteorite crashes into Github
# servers (even if it will not happen).
# https://gist.github.com/950441
@thevangelist
thevangelist / my-component.spec.js
Created August 4, 2016 13:06
The only React.js component test you'll ever need (Enzyme + Chai)
import React from 'react';
import { shallow } from 'enzyme';
import MyComponent from '../src/my-component';
const wrapper = shallow(<MyComponent/>);
describe('(Component) MyComponent', () => {
it('renders without exploding', () => {
expect(wrapper).to.have.length(1);
});