Skip to content

Instantly share code, notes, and snippets.

View roobie's full-sized avatar

Björn Roberg roobie

View GitHub Profile
@roobie
roobie / peg-exercises.janet
Created June 9, 2020 10:09 — forked from sogaiu/peg-exercises.janet
janet peg exercises
# 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
@roobie
roobie / levenshtein.js
Last active December 7, 2016 11:47 — forked from andrei-m/levenshtein.js
Levenshtein distance between two given strings implemented in JavaScript and usable as a Node.js module
/*
Copyright (c) 2011 Andrei Mackenzie
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
@roobie
roobie / jsintro.md
Last active November 16, 2018 09:54 — forked from joladev/jsintro.md
JavaScript Intro

Disciplin

JS är ett dynamiskt, svagt typat språk, vilket innebär att många skyddsnät som man är van vid när man använder ett statisk, starkt typat språk, som exv C#, inte finns.

Detta ställer höga krav på utvecklaren att skriva tydlig kod samt att implementera tillräckligt med felhantering och/eller kollar för att vara säker på att värden finns och är av rätt underliggande typ innan man använder dem.

ES2015, ESNext, TS etc.

Väldigt stor skillnad på vad man har tillgängligt beroende på vilken specifikation man bestämmer sig för att använda. Dagens webbläsare har kommit långt i att implementera moderna (läs ES2015) features, men man kan inte vara säker på att de har stöd för allt. Därför väljer man oftast i nya projekt att kompilera sin kod mot ES5, som det finns stöd för ända ned till IE9.

@roobie
roobie / config.el
Created February 9, 2016 23:42 — forked from mars888/config.el
Quick and dirty Spacemacs configuration layer for Tide and TypeScript
(spacemacs|defvar-company-backends typescript-mode)
@roobie
roobie / .Xdefaults
Last active August 29, 2015 14:23 — forked from yevgenko/.Xdefaults
!-------------------------------------------------------------------------------
! Xft settings
!-------------------------------------------------------------------------------
Xft.dpi: 96
Xft.antialias: false
Xft.rgba: rgb
Xft.hinting: true
Xft.hintstyle: hintslight