Skip to content

Instantly share code, notes, and snippets.

@caub
caub / .light
Last active March 15, 2018 09:50
#!/bin/bash
regexp='^[-+]?[0-9]*(\.[0-9]*)?$'
validateNumber() {
if [[ $1 == *[0-9]* && $1 =~ $regexp ]]; then
echo "$1"
else
printf >&2 '%s is not a valid number\n' "$1"
fi
}
@caub
caub / .gitconfig
Last active August 24, 2020 20:50
[user]
email = cyril.auburtin@gmail.com
name = caub
[alias]
a = add --all
au = add -u
b = branch
br = branch -r
amend = commit --amend -C HEAD
@phillip-haydon
phillip-haydon / jsonb_merge.sql
Created December 6, 2016 10:17
Deep Merge two jsonb documents in PostgreSQL
CREATE OR REPLACE FUNCTION jsonb_merge(left JSONB, right JSONB) RETURNS JSONB AS $$
var mergeJSON = function (target, add) {
function isObject(obj) {
if (typeof obj == "object") {
for (var key in obj) {
if (obj.hasOwnProperty(key)) {
return true; // search for first object prop
}
}
@ebidel
ebidel / fancy-tabs-demo.html
Last active March 8, 2024 23:08
Fancy tabs web component - shadow dom v1, custom elements v1, full a11y
<script src="https://unpkg.com/@webcomponents/custom-elements"></script>
<style>
body {
margin: 0;
}
/* Style the element from the outside */
/*
fancy-tabs {
margin-bottom: 32px;