Skip to content

Instantly share code, notes, and snippets.

View FernandoBasso's full-sized avatar

Fernando Basso FernandoBasso

View GitHub Profile
@FernandoBasso
FernandoBasso / init.js
Last active April 19, 2024 12:59
Pulsar Editor Sync Settings backups
// Your init script
//
// Pulsar will evaluate this file each time a new window is opened. It is run
// after packages are loaded/activated and after the previous editor state
// has been restored.
//
// An example hack to log to the console when each text editor is saved.
//
// atom.workspace.observeTextEditors(editor =>
// editor.onDidSave(() =>
@FernandoBasso
FernandoBasso / htdp-bsl-example.rkt
Last active October 15, 2021 22:43
Just to show some stuff that DrRacket inserts (when using htdp/bsl) and that is probably why some things were not working in emacs/geiser/repl.
#lang htdp/bsl
;; #reader(lib "htdp-beginner-reader.ss" "lang")((modname area-tests) (read-case-sensitive #t) (teachpacks ()) (htdp-settings #(#t constructor repeating-decimal #f #t none #f () #f)))
;; Given length of one side of square, produce the area of the square.
(check-expect (area-of-square 3) 3) ;; This test is wrong.
(check-expect (area-of-square 3.2) (* 3.2 3.2))
(define (area-of-square side)
(* side side))
@FernandoBasso
FernandoBasso / urlize.php
Last active April 15, 2021 10:19
Urlize a string for pretty urls and SEO.
<?php
// Thanks to: http://cubiq.org/the-perfect-php-clean-url-generator
function toAscii( $str, $replace = array(), $delimiter = '-' ) {
if( ! empty( $replace ) ) {
$str = str_replace( ( array ) $replace, ' ', $str);
}
$clean = iconv( 'UTF-8', 'ASCII//TRANSLIT', $str );
$clean = preg_replace( "/[^a-zA-Z0-9\/_|+ -]/", '', $clean );
@FernandoBasso
FernandoBasso / quotes-of-wisdom.txt
Last active October 22, 2020 12:28
Quotes of Wisdom
“I fear not the man who has practiced 10,000 kicks once, but I fear the
man who has practiced one kick 10,000 times.”
— Bruce Lee
“Eu não temo o homem que pratiou 10.000 chutes uma vez, mas sim do
homem que praticou um chute 10.000 vezes.”
“Se quiser testar o caráter de uma pessoa, dê poder a ela.”
— Abraham Lincoln
@FernandoBasso
FernandoBasso / firerox-code-injector-export.json
Last active September 19, 2019 10:40
Firefox Code Injector Settings Export
[{"enabled":true,"onLoad":true,"selector":"orgmode\\.org","code":{"js":"// Type your JavaScript code here.\n\n","css":"/* Type your CSS code here. */\n\nbody {\n max-width: 1024px;\n border: 1px #a09a98 dashed;\n padding: 12px;\n font-family: Ubuntu;\n}\n\npre, code, samp, tt {\n font-family: 'Source Code Pro';\n font-weight: 300;\n}\n","html":"<!-- Type your HTML code here. -->\n\n","files":[]}},{"enabled":true,"onLoad":true,"selector":"https://www.gnu.org/software/coreutils/manual/coreutils.html","code":{"js":"// Type your JavaScript code here.\n\n","css":"/* Type your CSS code here. */\n\nbody {\n max-width: 1024px;\n}","html":"<!-- Type your HTML code here. -->\n\n","files":[]}},{"enabled":true,"onLoad":true,"selector":"https://www.gnu.org/software/bash","code":{"js":"// Type your JavaScript code here.\n\n","css":"/* Type your CSS code here. */\n\nbody {\n max-width: 1024px;\n}\n\n.example pre {\n font-family: 'Source Code Pro';\n}","html":"<!-- Type your HTML code here. -->\n\n
@FernandoBasso
FernandoBasso / pacman-output.txt
Created August 29, 2019 22:41
pacman output :)
$ sudo pacman -Syyu
[sudo] password for fernando:
:: Synchronizing package databases...
core 132.8 KiB 305K/s 00:00 [################################################] 100%
extra 1705.4 KiB 2.47M/s 00:01 [################################################] 100%
community 4.9 MiB 2.91M/s 00:02 [################################################] 100%
multilib 169.5 KiB 12.7M/s 00:00 [################################################] 100%
:: Starting full system upgrade...
resolving dependencies...
looking for conflicting packages...
@FernandoBasso
FernandoBasso / markdown-collapse-summary-details.md
Last active August 10, 2019 10:14
Markdown Collapse Using Summary and Details Tags
@FernandoBasso
FernandoBasso / refactor-procedural-into-functional.js
Last active January 4, 2019 19:29
Example of turning a procedural-style code into a more functional one.
// Procedural
const getPhoneAreaAndNumber = ({ whatsappPhone, cellPhone, homePhone }) => {
if (whatsappPhone && isCellPhone(whatsappPhone)) return { area: getPhoneArea(whatsappPhone), number: getPhoneNumber(whatsappPhone) }
if (cellPhone && isCellPhone(cellPhone)) return { area: getPhoneArea(cellPhone), number: getPhoneNumber(cellPhone) }
if (homePhone && isCellPhone(homePhone)) return { area: getPhoneArea(homePhone), number: getPhoneNumber(homePhone) }
return { area: '', number: '' }
}
// We can turn the above into this:
@FernandoBasso
FernandoBasso / ruby-devkit-windows.org
Last active July 9, 2018 19:20
Install and configure Ruby and Ruby DevKit on Windows

Ruby Devkit Windows

Why‽

*nix is much better for development in general, and those who disagree are just plain wrong (in my supreme opinion). Still, sometimes we are forced to work on Windows (someone from “above” orders such an unspeakable thing, and the others, lesser human beings are oblidged to comply).

Ruby Installer

Download: Ruby Installer Downloads

@FernandoBasso
FernandoBasso / examples-map-filter-reduce.js
Last active July 3, 2018 16:12
ECMAScript map, filter, reduce
const p = console.log.bind(console);
///////////////////////////////////////////////////////////////////////////////
let nums = [3, 12, 21, 27, 44];
let odds = nums.filter(num => num % 2 != 0);
p(odds);
// → [ 3, 21, 27 ]