Skip to content

Instantly share code, notes, and snippets.

View the-glima's full-sized avatar
🎧
Helping robots to steal all jobs

Gabriel Lima the-glima

🎧
Helping robots to steal all jobs
View GitHub Profile
@the-glima
the-glima / get-json-value.sh
Created January 12, 2021 11:09
Get Json Value
#!/usr/bin/env bash
PROP=$1
FILE_PATH=$2
function getJsonValue {
if [[ -z "$PROP" ]]; then
echo "You need to pass the property name"
exit 1
elif [[ -z "$FILE_PATH" ]]; then
@the-glima
the-glima / debounce.js
Created November 27, 2020 01:54
Debounce
const debounce = (callback: Function, delay: number) => {
let timeout: any;
return (...args: any) => {
clearTimeout(timeout)
timeout = setTimeout(() => {
timeout = null
callback(...args)
}, delay)
}
@the-glima
the-glima / IndexDB
Last active September 22, 2020 14:49
indexdb.js
dla.helper.createNamespace('dla.payment.binBlocked');
dla.payment.binBlocked = function () {
class Store {
constructor(dbName, storeName) {
this.storeName = storeName;
this._dbp = new Promise((resolve, reject) => {
const openreq = indexedDB.open(dbName, 1);
openreq.onerror = () => reject(openreq.error);
openreq.onsuccess = () => resolve(openreq.result);
// First time setup: create an empty object store
@the-glima
the-glima / _z-indexes.md
Last active May 26, 2021 03:34
[SCSS] Managing and Logging z-index #website

Managing and logging z-indexes

Let's say that you want to use a z-index value in a project (specially a big one) but you are not sure if there's something else using the same z-index value or a higher one, it could cover up your new cool thing, so what you do?

Easy, just use 9999 and consider this job done 😎 👎🏼

But that is the little devil 😈 on your shoulder winning the battle. So let's try to listen to the angel 👼🏼 this time.

Variables - Mappings

@the-glima
the-glima / agnoster.zsh-theme
Last active March 15, 2021 14:29
Oh My Zsh - Agnoster Theme
# vim:ft=zsh ts=2 sw=2 sts=2
#
# agnoster's Theme - https://gist.github.com/3712874
# A Powerline-inspired theme for ZSH
#
# # README
#
# In order for this theme to render correctly, you will need a
# [Powerline-patched font](https://github.com/Lokaltog/powerline-fonts).
# Make sure you have a recent version: the code points that Powerline
syntax on
set nocompatible " be iMproved, required
filetype off " required
set termguicolors
if has("mouse")
set mouse=a
endif
@the-glima
the-glima / angular-logo.svg
Last active January 30, 2023 16:26
[Logos] Tech/Language Logos
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@the-glima
the-glima / trigger-github-action.sh
Last active April 4, 2021 18:53
[Bash] Triggering a GitHub Action Arbitrarily #website
#!/usr/bin/env bash
REPO_PATH=$1
GITHUB_TOKEN=$2
function triggerGithubAction() {
echo "Running Manual GitHub Action Trigger for: ${REPO_PATH}"
curl -H "Accept: application/vnd.github.everest-preview+json" \
-H "Authorization: token ${GITHUB_TOKEN}" \
@the-glima
the-glima / intl-datetime-format.js
Last active January 20, 2021 14:38
Formatting date with Intl.DateTimeFormat #website
// You can use Intl.DateTimeFormat (Vanilla JS) to format a date
const date = Date.now()
// In basic use without specifying a locale, DateTimeFormat uses the default locale and default options
new Intl.DateTimeFormat().format(date)
// 5/29/2020
new Intl.DateTimeFormat('en-US').format(date)
// 5/29/2020
@the-glima
the-glima / dark-mode.css
Created May 29, 2020 02:29
Easiest way to add Dark Mode #website
/*
You can use prefers-color-scheme media query to detect user's color theme.
The easiest and best way to add Dark Mode to your project.
*/
:root {
--color-text: black;
--color-background: white;
}
@media screen and (prefers-color-scheme: dark) {