Skip to content

Instantly share code, notes, and snippets.

Avatar
🚲

Cyril Auburtin caub

🚲
View GitHub Profile
View .light
#!/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
}
View .gitconfig
[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 Dec 6, 2016
Deep Merge two jsonb documents in PostgreSQL
View jsonb_merge.sql
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 Aug 27, 2021
Fancy tabs web component - shadow dom v1, custom elements v1, full a11y
View fancy-tabs-demo.html
<script>
function execPolyfill() {
(function(){
// CustomElementsV1.min.js v1 polyfill from https://github.com/webcomponents/webcomponentsjs/tree/v1/src/CustomElements/v1.
/*
Copyright (c) 2016 The Polymer Project Authors. All rights reserved.
This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt