Skip to content

Instantly share code, notes, and snippets.

[
{ "keys": ["ctrl+shift+x"], "command": "tidy_xml" },
{ "keys": ["ctrl+shift+j"], "command": "prettify_json" }
]
@laurent22
laurent22 / dummyconsole.js
Last active December 15, 2015 01:29
Fake Javascript console to avoid errors in browsers that don't support the feature.
if (typeof(console) === 'undefined') {
var functionNames = ['info', 'error', 'warn', 'dir', 'trace', 'log', 'assert'];
console = {};
for (var i = 0; i < functionNames.length; i++) console[functionNames[i]] = function(){};
}
@laurent22
laurent22 / extractBaseUrl
Created July 15, 2013 11:30
Extracts base URL from location of current document.
// Extracts base URL from location of current document.
function extractBaseUrl() {
// Get URL without query path
var url = [location.protocol, '//', location.host, location.pathname].join('');
// Remove filename if present
var f = url.substr(url.lastIndexOf("/") + 1).toLowerCase();
if (f.indexOf('.html') >= 0 || f.indexOf('.htm') >= 0 || f.indexOf('.php')) {
url = url.substr(0, url.length - f.length);
}
// Add last slash if missing
@laurent22
laurent22 / levenshteinDistance.go
Last active November 22, 2018 16:06
Golang function to calculate Levenshtein distance between two strings. Adapted from Wikipedia article.
import (
"math"
"strings"
)
func levenshteinDistance(s string, t string) int {
// degenerate cases
s = strings.ToLower(s)
t = strings.ToLower(t)
if (s == t) { return 0 }
@laurent22
laurent22 / LABY2.BAS
Created October 13, 2017 10:33
LABY2.BAS
80 Position:
'Dessin du premier plan
IF dir = 1 THEN pos$ = LEFT$(piece$, 3)
IF dir = 2 THEN pos$ = RIGHT$(piece$, 3)
IF dir = 3 THEN pos$ = RIGHT$(piece$, 2) + LEFT$(piece$, 1)
IF dir = 4 THEN pos$ = RIGHT$(piece$, 1) + LEFT$(piece$, 2)
IF LEFT$(pos$, 1) = "1" THEN
LINE (10, 10)-(134, 76)
LINE -(134, 274)
LINE -(10, 340)
@laurent22
laurent22 / strange regex
Last active March 19, 2018 12:17
strange regex
()([t[lÅ[eèéẻẽẹêềếểễệëěēęEÈÉẺẼẸÊỀẾỂỄỆËĚĒĘ]
LÅ[eèéẻẽẹêềếểễệëěēęEÈÉẺẼẸÊỀẾỂỄỆËĚĒĘ]
][a[eèéẻẽẹêềếểễệëěēęEÈÉẺẼẸÊỀẾỂỄỆËĚĒĘ]
[\s]+[eèéẻẽẹêềếểễệëěēęEÈÉẺẼẸÊỀẾỂỄỆËĚĒĘ]
¡[eèéẻẽẹêềếểễệëěēęEÈÉẺẼẸÊỀẾỂỄỆËĚĒĘ]
[eèéẻẽẹêềếểễệëěēęEÈÉẺẼẸÊỀẾỂỄỆËĚĒĘ]
£[eèéẻẽẹêềếểễệëěēęEÈÉẺẼẸÊỀẾỂỄỆËĚĒĘ]
£[eèéẻẽẹêềếểễệëěēęEÈÉẺẼẸÊỀẾỂỄỆËĚĒĘ]
[eèéẻẽẹêềếểễệëěēęEÈÉẺẼẸÊỀẾỂỄỆËĚĒĘ]
¡[eèéẻẽẹêềếểễệëěēęEÈÉẺẼẸÊỀẾỂỄỆËĚĒĘ]
const daysPerMonth = [
31,
28,
31,
30,
31,
30,
31,
31,
30,
@laurent22
laurent22 / javascript_warnings.md
Last active August 7, 2022 09:27
How many warnings should your JavaScript app have?

How many warnings should your JavaScript app have?

JavaScript warnings are these messages being displayed in yellow or red in your JavaScript console or terminal. They make no sense at all in general but they are a good indication of the health of your app. The points below will give you a general idea of how many warnings you should expect in your app:

  • 0 warnings: the app is not working at all

  • 5 warnings: app is probably starting but crashing soon after - try to find why it crashes. You'd think you could read the warnings to learn why it doesn't work, but that's not what warnings are for.

  • 50 warnings: That's the soft spot - most likely everything's running smoothly

Individual Contributor License Agreement

Thank you for your interest in the Joplin applications, owned by JOPLIN, registered in France, 3 Place Simone Veil, CS 20739 54064 Nancy (the "Company"). In order to clarify the intellectual property license granted with Contributions from any person or entity, the Company must have a Contributor License Agreement ("CLA") on file that has been signed by each Contributor, indicating agreement to the license terms below. This license is for your protection as a Contributor as well as the protection of the Company and its users; it does not change your rights to use your own Contributions for any other purpose.

DEBUG: Using RE2 as regex engine
DEBUG: Parsing configs
DEBUG: Checking for config file in /runner/renovate/job_config.json
DEBUG: Detected config in env RENOVATE_CONFIG
{
"config": {
"extends": [
"mergeConfidence:all-badges"
],
"prFooter": "This PR has been generated by [Mend Renovate](https://www.mend.io/free-developer-tools/renovate/). View repository job log [here](https://developer.mend.io/{{platform}}/{{repository}}).",