Skip to content

Instantly share code, notes, and snippets.

View rodrigocfd's full-sized avatar

Rodrigo rodrigocfd

  • Brazil
  • 17:35 (UTC -03:00)
View GitHub Profile
@rodrigocfd
rodrigocfd / tabify.js
Last active December 15, 2024 23:25
Convert spaces to tabs
/**
* Converts spaces to tab on all files within a folder, recursively.
* Rodrigo Dias <rcesar@gmail.com>
* Friday, December 13, 2024.
*/
const fs = require('fs');
const path = require('path');
const skipDir = ['.git', 'node_modules'];
@rodrigocfd
rodrigocfd / vscode.java.prefs
Last active May 24, 2024 03:58
Java preferences for Visual Studio Code
# Setting preferences:
# "java.settings.url": "/home/rodrigo/apps/vscode.java.prefs",
# https://github.com/redhat-developer/vscode-java/wiki/Settings-Global-Preferences
#
# General reference:
# https://git.eclipse.org/r/plugins/gitiles/platform/eclipse.platform.debug/+/0b578a4efb6323cc3cdcdea5ef1783eaa717088f/org.eclipse.core.variables/.settings/org.eclipse.jdt.core.prefs
org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException=warning
org.eclipse.jdt.core.compiler.problem.unusedLabel=warning
org.eclipse.jdt.core.compiler.problem.unusedLocal=warning
@rodrigocfd
rodrigocfd / extends.d.ts
Last active December 23, 2024 18:13
Extending TypeScript built-in types
/**
* Extensões de objetos nativos
* As implementações estão em src/util/func/extends.ts
*/
export {};
declare global {
interface Array<T> {
/** Checks if indexOf() !== -1. */
@rodrigocfd
rodrigocfd / userChrome.css
Last active July 27, 2025 13:52
Unfucks Firefox beyond 89 (Proton) on Windows - updated for 141
/* https://addons.mozilla.org/en-US/firefox/addon/windows-10-dimmed/ */
/* https://www.reddit.com/r/firefox/comments/1ftnlvn/firefox_v1310/lpth76q/ */
#alltabs-button {display: none !important;}
/* Revert tab throbber - for Nightly 57 as of 9/20/2017 */
.tab-throbber[busy]::before {
/* https://www.reddit.com/r/FirefoxCSS/comments/1em6fzz/tab_loading_throbber_icons_removed_in_129/ */
/* Download the PNG and place it in the same folder of useChrome.css */
background-image: url('loading.png') !important;
@rodrigocfd
rodrigocfd / .bashrc
Last active September 29, 2025 21:28
My very own .bashrc
alias l='ls --color=auto'
alias la='l -a'
alias ll='l -lh'
alias lla='l -alh'
export HISTCONTROL=ignoreboth:erasedups # https://askubuntu.com/a/15929
# https://thucnc.medium.com/how-to-show-current-git-branch-with-colors-in-bash-prompt-380d05a24745
gitbranch() {
git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/ \1/'
@rodrigocfd
rodrigocfd / gh.sh
Last active January 22, 2021 19:04
Deploy WinSafe docs to gh-pages branch
# Generates the doc and deploys it to gh-pages branch,
# which must be in the $GHP directory.
# https://gist.github.com/rodrigocfd/3a0f3370817ec5c8c3d2ec6e516ae86b
GHP=../gh-pages-winsafe # target gh-pages repo folder
cargo doc # generate locally
cd $GHP
git rm -r . # remove previous html files
<html>
<head>
<meta charset="UTF-8" />
<style>
.poster {
padding: 2%; /* white border */
position: relative;
box-sizing: border-box;
display: inline-block;
background-color: #fff;
@rodrigocfd
rodrigocfd / DeepReadonly.ts
Created January 30, 2019 11:43
TypeScript DeepReadonly generic type.
type DeepReadonly<T> =
T extends (infer R)[] ? DeepReadonlyArray<R> :
T extends Function ? T :
T extends object ? DeepReadonlyObject<T> :
T;
interface DeepReadonlyArray<T> extends ReadonlyArray<DeepReadonly<T>> { }
type DeepReadonlyObject<T> = {
readonly [P in keyof T]: DeepReadonly<T[P]>;
@rodrigocfd
rodrigocfd / readLines.js
Created January 8, 2019 11:29
Reads a file line by line and returns a string array in JavaScript and Node.js.
'use strict';
const fs = require('fs');
const readline = require('readline');
function readLines(fileName) {
return new Promise((resolve, reject) => {
if (!fs.existsSync(fileName)) {
return reject('File not found: ' + fileName);
}
@rodrigocfd
rodrigocfd / github-markdown.css
Created November 17, 2017 11:51
GitHub CSS markdown for Visual Studio Code.
/**
* Save this file and tell VSCode to use it:
* "markdown.styles": ["/home/your_name/.config/Code/User/github-markdown.css"]
*/
body {
font-family: Arial;
font-size: 16px;
margin-top: 18px;
color: #24292e;