Skip to content

Instantly share code, notes, and snippets.

@jbardon
jbardon / .zsh_plugins.txt
Last active July 27, 2020 16:37
zsh setup
Aloxaf/fzf-tab
changyuheng/fz
# olets/zsh-abbr
mattmc3/zsh-safe-rm
#> wfxr/forgit
zsh-users/zsh-autosuggestions
zsh-users/zsh-completions
zsh-users/zsh-history-substring-search
zsh-users/zsh-syntax-highlighting
@jbardon
jbardon / HttpBasicAuthenticationHandler.cs
Last active April 24, 2020 08:08
.NET Core Http Basic authentication handler
using System;
using System.Linq;
using System.Net.Http.Headers;
using System.Text;
using System.Text.Encodings.Web;
using System.Threading.Tasks;
using auth_netcore.Services;
using Microsoft.AspNetCore.Authentication;
using Microsoft.AspNetCore.Http;
using Microsoft.Extensions.DependencyInjection;
@jbardon
jbardon / iso8601
Created October 31, 2019 08:19
#1: Timezone & dates
November 11, 2018 at 12:51:43 AM (in a time zone at UTC+00:00)
2018-11-05T12:51:43Z <- Z stands for UTC
November 11, 2018 at 12:51:43 AM (in a time zone at UTC +07:30)
2018-11-05T12:51:43+07:30
@jbardon
jbardon / app.component.html
Last active June 4, 2019 13:50
Table component with Angular TemplateRef and ViewContainerRef
<!-- Test your customElement inside an angular environment here -->
<ld-test [data]="data">
<div slot="header">
<template column="position">
<th (click)="testClick($event)">Position {{coucou}}</th>
<td var="element">#%element.position%</td>
</template>
<template column="weight">
<th>Weight</th>
@jbardon
jbardon / tests.html
Last active May 17, 2019 14:38
RxJS
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>RxJS example</title>
<link rel="stylesheet" href="https://code.jquery.com/qunit/qunit-2.9.2.css">
</head>
<body>
<div id="qunit"></div>
{
"version": "2.0.0",
"tasks": [
{
"label": "Build Smart",
"type": "shell",
"command": "/c/Program Files (x86)/Microsoft Visual Studio/2017/Professional/MSBuild/15.0/Bin/MSBuild.exe",
"args": [
"/c/git/manage/Smart-Admin.sln",
"/target:Build",
digraph repo {
// https://git-scm.com/book/en/v2/Distributed-Git-Contributing-to-a-Project#_private_team
// dot -Tpng git.dot -o git.png && open git.png
rankdir = RL;
graph[compound=true];
node [style="rounded,filled", shape="box", width="1"];
edge [color="#9d9791"];
subgraph cluster_master_0 {
@jbardon
jbardon / getopt.sh
Created November 25, 2018 09:33
Traitement automatique des options bash
myscript -vfd ./foo/bar/someFile -o /fizz/someOtherFile
myscript -v -f -d -o/fizz/someOtherFile -- ./foo/bar/someFile
myscript --verbose --force --debug ./foo/bar/someFile -o/fizz/someOtherFile
myscript --output=/fizz/someOtherFile ./foo/bar/someFile -vfd
myscript ./foo/bar/someFile -df -v --output /fizz/someOtherFile
verbose: y, force: y, debug: y, in: ./foo/bar/someFile, out: /fizz/someOtherFile
#!/bin/bash
# saner programming env: these switches turn some bugs into errors
@jbardon
jbardon / learn-git.sh
Created November 22, 2018 11:18
Learn git (Medium article)
#!/bin/bash
mkdir learn-git
cd learn-git
# Init repository
git init
touch react.txt
touch vue.txt
git add .
@jbardon
jbardon / promisify-example.js
Created November 13, 2018 12:03
#12 You know nothing (medium)
function withCallback (message, callback) {
callback(message);
}
function promisify (functionToCall) {
return function promisifiedFunction () {
// Before new Promise otherwise arguments value change
var callArguments = Array.from(arguments);
return new Promise (function (resolve, reject) {