Skip to content

Instantly share code, notes, and snippets.

View giammyisjammy's full-sized avatar
:atom:
I may be slow to respond.

Gianmarco giammyisjammy

:atom:
I may be slow to respond.
View GitHub Profile
@m-radzikowski
m-radzikowski / script-template.sh
Last active April 21, 2025 17:51
Minimal safe Bash script template - see the article with full description: https://betterdev.blog/minimal-safe-bash-script-template/
#!/usr/bin/env bash
set -Eeuo pipefail
trap cleanup SIGINT SIGTERM ERR EXIT
script_dir=$(cd "$(dirname "${BASH_SOURCE[0]}")" &>/dev/null && pwd -P)
usage() {
cat <<EOF
Usage: $(basename "${BASH_SOURCE[0]}") [-h] [-v] [-f] -p param_value arg1 [arg2...]
@blakek
blakek / columns-prop.js
Last active August 29, 2021 15:54
Styled Components - columns helper
/**
* Adds `columns` prop allowing setting width based on an object.
* @example <caption>100% width on smaller screens; 1/2 width on medium-sized screen</caption>
* <Component columns={{ md: 6 }} />
* @example <caption>8 columns on smaller screens; 2 columns starting at samm screen</caption>
* <Component columns={{ default: 8, sm: 2 }} />
*/
const columns = css`
width: ${p =>
setColumnWidth(getOr(12, 'columns.default', p), p.theme.gridSettings)};
@martinobordin
martinobordin / AngularRxJs5DateHttpInterceptor.ts
Last active October 31, 2024 17:32
An Angular interceptor to parse string dates (ISO8601 format) from server response to JS Date Object. There are both RxJs 5 and RxJs 6 versions
import { Injectable } from '@angular/core';
import { HttpRequest, HttpHandler, HttpEvent, HttpInterceptor, HttpErrorResponse, HttpResponse } from '@angular/common/http';
import { Observable } from 'rxjs/Observable';
import 'rxjs/add/operator/do';
@Injectable()
export class AngularDateHttpInterceptor implements HttpInterceptor {
// Migrated from AngularJS https://raw.githubusercontent.com/Ins87/angular-date-interceptor/master/src/angular-date-interceptor.js
iso8601 = /^\d{4}-\d\d-\d\dT\d\d:\d\d:\d\d(\.\d+)?(([+-]\d\d:\d\d)|Z)?$/;
@parmentf
parmentf / GitCommitEmoji.md
Last active April 24, 2025 05:25
Git Commit message Emoji
@niksumeiko
niksumeiko / git.migrate
Last active April 10, 2025 01:10
Moving git repository and all its branches, tags to a new remote repository keeping commits history
#!/bin/bash
# Sometimes you need to move your existing git repository
# to a new remote repository (/new remote origin).
# Here are a simple and quick steps that does exactly this.
#
# Let's assume we call "old repo" the repository you wish
# to move, and "new repo" the one you wish to move to.
#
### Step 1. Make sure you have a local copy of all "old repo"
### branches and tags.