Skip to content

Instantly share code, notes, and snippets.

View wegry's full-sized avatar

Zach Wegrzyniak wegry

  • Boston
  • 23:41 (UTC -05:00)
View GitHub Profile
@ryanpedersen42
ryanpedersen42 / config.yml
Last active May 8, 2024 13:00
Path filtering example
version: 2.1
setup: true
orbs:
path-filtering: circleci/[email protected]
workflows:
setup-workflow:
jobs:
@RomiC
RomiC / vscode_when_conditions_list.txt
Created February 27, 2020 06:49
VSCode keybindings "when"-conditions list (includes some plugins)
acceptSuggestionOnEnter
accessibilityHelpWidgetVisible
accessibilityModeEnabled
activeEditor == 'WebviewEditor'
activeEditor == 'workbench.editor.extension'
activeEditorGroupEmpty
activePanel == 'refactorPreview'
atEndOfWord
breadcrumbsActive
breadcrumbsPossible
@lilactown
lilactown / promises.re
Last active August 20, 2022 07:56
Notes on using JavaScript Promises in ReasonML/BuckleScript
/**
* Making promises
*/
let okPromise = Js.Promise.make((~resolve, ~reject as _) => [@bs] resolve("ok"));
/* Simpler promise creation for static values */
Js.Promise.resolve("easy");
Js.Promise.reject(Invalid_argument("too easy"));
@busypeoples
busypeoples / README.md
Last active February 8, 2022 08:41
Making Impossible States Impossible in ReasonML

Making Impossible States Impossible in ReasonML

Introduction

If you have already seen Richard Feldman's talk entitled "Making Impossible States Impossible" or have read "Designing with types: Making illegal states unrepresentable" then you can skip the explanations and just head straight to the Reason examples.

This post is intended to display how to model your Reason Application to prevent creating impossible states. The benefits of being able to design a feature in this way include avoiding having to deal with complex test scenarios regarding defined business rules and a clear documentation of what is possible just by looking at the type definition. Long story short, let's see how this all works by implementing an example.

Requirements

@Jakobud
Jakobud / _map-sort.scss
Last active June 20, 2022 14:50
Sort a SASS map
/// map-sort
/// Sort map by keys
/// @param $map - A SASS map
/// @returns A SASS map sorted by keys
/// @requires function list-sort
/// @author Jake Wilson <[email protected]>
@function map-sort($map) {
$keys: list-sort(map-keys($map));
$sortedMap: ();
@each $key in $keys {
@Jakobud
Jakobud / _list-sort.scss
Last active August 20, 2022 22:09
Sort a SASS list
/// list-sort
/// Sort a SASS list
/// @param $list - A SASS list
/// @returns A sorted SASS list
/// @requires function list-remove
/// @author Jake Wilson <[email protected]>
@function list-sort($list) {
$sortedlist: ();
@while length($list) > 0 {
$value: nth($list,1);
@praeclarum
praeclarum / Matrix.fs
Created May 26, 2016 05:06
Basic matrix math in F#
module Drone.Control.Matrix
open System
type Matrix =
| MZero of int * int
| MEye of int * float
| MArray of float[,]
| MTranspose of Matrix
| MDiagonal of float[]
@simonw
simonw / how-to.md
Last active November 5, 2024 00:07
How to create a tarball of a git repository using "git archive"
@varemenos
varemenos / 1.README.md
Last active October 23, 2024 13:07
Git log in JSON format

Get Git log in JSON format

git log --pretty=format:'{%n  "commit": "%H",%n  "abbreviated_commit": "%h",%n  "tree": "%T",%n  "abbreviated_tree": "%t",%n  "parent": "%P",%n  "abbreviated_parent": "%p",%n  "refs": "%D",%n  "encoding": "%e",%n  "subject": "%s",%n  "sanitized_subject_line": "%f",%n  "body": "%b",%n  "commit_notes": "%N",%n  "verification_flag": "%G?",%n  "signer": "%GS",%n  "signer_key": "%GK",%n  "author": {%n    "name": "%aN",%n    "email": "%aE",%n    "date": "%aD"%n  },%n  "commiter": {%n    "name": "%cN",%n    "email": "%cE",%n    "date": "%cD"%n  }%n},'

The only information that aren't fetched are:

  • %B: raw body (unwrapped subject and body)
  • %GG: raw verification message from GPG for a signed commit
@pilwon
pilwon / test-es6-imports.js
Created March 29, 2015 06:57
Tests if regex matches all valid ES6 import syntaxes. https://github.com/facebook/react-native/pull/386
//
// Tests if regular expression matches all valid ES6 import syntaxes.
//
// ES6 Language Specification Reference:
// https://people.mozilla.org/~jorendorff/es6-draft.html#sec-imports
//
const ES6_IMPORT_REGEX = /\bimport\s+(?:.+\s+from\s+)?[\'"]([^"\']+)["\']/g;
const VALID_ES6_IMPORT_SYNTAXES = [