Skip to content

Instantly share code, notes, and snippets.

View FernandoBasso's full-sized avatar

Fernando Basso FernandoBasso

View GitHub Profile
const toUnixTime = (date) => date.getTime() / 1000;
const usageInterval = (start, end) => ({
start: toUnixTime(start),
end: toUnixTime(end)
});
const getSyndayOfTheWeek = (currentDate) => {
const date = new Date(currentDate.getFullYear(), currentDate.getMonth(), currentDate.getDate());
@JohnDinhDev
JohnDinhDev / Reset Udemy Progress.md
Last active April 14, 2024 11:09
Reset Udemy Progress

Reset Udemy Progress

Last Updated: 09/30/2022

Step 1. Go to Udemy course in browser

Go to the course and have any video up. The following code relies on the right sidebar to be visible to uncheck all your progress.

Step 2. Open browser console

You can do this with ctrl+shift+j and making sure the console tab is selected for chrome/brave

@havenwood
havenwood / multiple_instances_of_state.rb
Last active March 11, 2022 17:51
Examples of a module, class and singleton class in Ruby
class MultipleInstancesOfState
attr_accessor :state
def initialize(state:)
@state = state
end
def foo
@state.reverse!
end
@skyzyx
skyzyx / homebrew-gnubin.md
Last active April 24, 2024 00:04
Using GNU command line tools in macOS instead of FreeBSD tools

macOS is a Unix, and not built on Linux.

I think most of us realize that macOS isn't a Linux OS, but what that also means is that instead of shipping with the GNU flavor of command line tools, it ships with the FreeBSD flavor. As such, writing shell scripts which can work across both platforms can sometimes be challenging.

Homebrew

Homebrew can be used to install the GNU versions of tools onto your Mac, but they are all prefixed with "g" by default.

All commands have been installed with the prefix "g". If you need to use these commands with their normal names, you can add a "gnubin" directory to your PATH from your bashrc.

@rodolfobandeira
rodolfobandeira / to_bool.md
Created April 7, 2019 13:45
Convert string to boolean in Ruby
  def to_bool(string)
    if string == true || string == 1 || string =~ (/(true|1)$/i)
      true
    else
      false
    end
  end
import PropTypes from 'prop-types';
type Omit<T, K> = Pick<T, Exclude<keyof T, K>>;
type Defined<T> = T extends undefined ? never : T;
/**
* Get the type that represents the props with the defaultProps included.
*
* Alternatively, we could have done something like this:
@arturfog
arturfog / gnome-terminal-bold-fonts.sh
Created January 2, 2019 15:03
disable bold fonts in gnome terminal
dconf write /org/gnome/terminal/legacy/profiles:/:<id>/allow-bold false
@lunks
lunks / gruvbox-dark.conf
Last active April 25, 2024 04:21
gruvbox-dark theme for kitty - the fast, featureful, GPU based terminal emulator
# gruvbox-dark colorscheme for kitty
# snazzy theme used as base
foreground #ebdbb2
background #272727
selection_foreground #655b53
selection_background #ebdbb2
url_color #d65c0d
# black
@Yevgnen
Yevgnen / emacs26.sh
Created June 3, 2018 11:09 — forked from kissge/emacs26.sh
Compile Emacs 26 on Ubuntu 16.04
mkdir emacs
cd emacs
git init
git remote add origin https://github.com/emacs-mirror/emacs.git
git fetch --depth 1 origin emacs-26
git reset --hard FETCH_HEAD
sudo apt install autoconf make gcc texinfo libgtk-3-dev libxpm-dev libjpeg-dev libgif-dev libtiff5-dev libgnutls-dev libncurses5-dev
./autogen.sh
./configure
make
@chandraratnam
chandraratnam / mutt_mbsync_multipleaccounts.md
Last active March 27, 2024 00:46
Mutt + isync mbsync + gmail + multiple accounts.

Mutt + isync multiple accounts Unfinished

This is the setup that I use for mutt, I have two google domain account (read as gmail) and an institution where I work and study account. This means I have two gmail accounts and one outlook 365 account that i want to sync and read via mutt.

I want to store all my email locally as I travel a lot and will be in countries without easy internet access. For this I use mbsync (iSync). As it can handle multiple account types easily and efficently.

The setup works this way

[Remote Mail Servers] <= mbsync => [Local Mail Folders]