This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Lightweight implementation of the famous `Maybe` type that safely wraps | |
* optional values without using `null` references. | |
* | |
* Add this file to your project and get three new namespaces: | |
* - `Option`: the base type, factories, operators (map, bind, filter, tap, | |
* flatten), and means to get the contained value. | |
* - `Option.Extras`: some utility functions like `IEnumerable.FirstOrNone()`, | |
* combinators (and, or, ...), and maybe-ready `TryParse` functions. | |
* - `Option.Async`: async variants of the operators so you can bind against |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# find * and + to be confusing, trying to use sequence and choice instead | |
(def peg-simple | |
~{:main (capture (some :S))}) | |
(peg/match peg-simple "hello") # => @["hello"] | |
# from: | |
# https://janet-lang.org/docs/peg.html | |
(defn finder |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Red [ | |
title: "Red Object Browser" | |
author: "Gregg Irwin" | |
needs: 'View | |
] | |
e.g.: :comment | |
map-ex: func [ | |
"Evaluates a function for all values in a series and returns the results." |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(spacemacs|defvar-company-backends typescript-mode) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Visualizing branch topology in git on the commandline | |
git log --graph --oneline --full-history --all | |
git log --graph --full-history --all --pretty=format:"%h%x09%d%x20%s" | |
# With colors in Bash: | |
git log --graph --full-history --all --color --pretty=format:"%x1b[31m%h%x09%x1b[32m%d%x1b[0m%x20%s" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var formatString = (function () { | |
/** | |
formatString | |
Expected arguments: | |
format[0]: <String> The format. It uses a specific interpolation notation. | |
data[1]: <Object|Array<Object>> The data to interpolate | |
Throws: | |
TypeError: If format is null or undefined |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# myapp/partner/strategy.py | |
from decimal import Decimal as D | |
from oscar.apps.partner import strategy, prices | |
DEFAULT_RATE = D('0.196') | |
PRODUCT_CLASSES_RATES = { | |
'cours': 0, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var defer = function () { | |
var value, | |
resolution, | |
handlers = {}; | |
var fulfill = function () { | |
if (resolution) { | |
var handler = handlers[resolution]; | |
if (handler) { | |
handler(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
defmodule Levenshtein do | |
def first_letter_check(one_letter, two_letter) do | |
case one_letter == two_letter do | |
true -> 0 | |
false -> 1 | |
end | |
end | |
def distance(string_1, string_1), do: 0 | |
def distance(string, ''), do: :string.len(string) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
!------------------------------------------------------------------------------- | |
! Xft settings | |
!------------------------------------------------------------------------------- | |
Xft.dpi: 96 | |
Xft.antialias: false | |
Xft.rgba: rgb | |
Xft.hinting: true | |
Xft.hintstyle: hintslight |
NewerOlder