Skip to content

Instantly share code, notes, and snippets.

View santospatrick's full-sized avatar
👽
Javascripting

Patrick Santos Bitonti Teixeira santospatrick

👽
Javascripting
View GitHub Profile
@santospatrick
santospatrick / setup-mac.sh
Last active April 21, 2023 15:59
MacOSX Setup for Development
#!/usr/bin/env bash
# 1. Run this script file
# bash <(curl -Ls https://bit.ly/3swaoUr)
# Homebrew & Apps
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
echo 'eval "$(/opt/homebrew/bin/brew shellenv)"' >> /Users/$USER/.zprofile
eval "$(/opt/homebrew/bin/brew shellenv)"
brew update
@leodutra
leodutra / -setup-windows-wsl-devenv.md
Last active July 5, 2024 19:15
Install and Setup Windows Subsystem 2 for Linux, Hyper, ZSH + Oh My Zsh + Powerlevel9k + plugins, FNM + VSCode (+ext) and Nerd Font

Setup Windows Subsystem 2 for Linux

Windows Subsystem 2 for Linux, Hyper, ZSH + Oh My Zsh + Powerlevel9k + plugins, FNM + VSCode (+ext) and Nerd Font

To setup native Linux, see this gist

Preview

Requirements

@ademilter
ademilter / .storybook
Last active September 7, 2021 12:11
postcss config for storybook
- webpack.config.js
- postcss.config.js
- config.js
- addons.js
@GabrielShaad
GabrielShaad / filterList.js
Last active October 2, 2018 13:06
Filter list of objects to match normalized string and return an array of matches.
function _normalizeString(value) {
return value
.toString()
.replace(/á|ã|â/g, 'a')
.replace(/é|ê/g, 'e')
.replace(/í/g, 'i')
.replace(/ó|ô|õ/g, 'o')
.replace(/ú/g, 'u')
.replace(/ç/g, 'c')
.replace(/_/g, '');
xcode-select --install
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
brew update
brew cask install iterm2
# update iterm2 settings -> colors, keep directory open new shell, keyboard shortcuts
brew install bash # latest version of bash
# set brew bash as default shell
brew install fortune
brew install cowsay
brew install git
@guregu
guregu / fix-image-maps.js
Created October 17, 2017 14:40
Responsive image maps (vanilla JS)
function fixImageMaps(force) {
var imgs = document.querySelectorAll("img[usemap]");
[].forEach.call(imgs, function(img) {
if (!img.naturalHeight) { return; }
var h = img.height / img.naturalHeight;
var w = img.width / img.naturalWidth;
var map = document.getElementsByName(img.useMap.slice(1))[0];
if (!map) { return; }
for (var i = 0; i < map.children.length; i++) {
var area = map.children[i];
@jaredpalmer
jaredpalmer / patch.js
Created August 26, 2017 21:06
Change the port in CRA's WebpackHotDevClient.
const fs = require('fs');
// Monkey-patch react-dev-utils to get the error overlay with SSR
const pathToDevClient = 'node_modules/react-dev-utils/webpackHotDevClient.js';
// The react-scripts default
const reactScriptsPort = 3000;
// Read the dev client out of node_modules
const HotDevClient = fs.readFileSync(pathToDevClient, 'utf8');
@santospatrick
santospatrick / terminal-oh-my-zsh.md
Last active June 14, 2024 18:14
Terminal with oh-my-zsh (Linux/Windows/MacOSX)

Terminal with oh-my-zsh (Linux/Windows/MacOSX)

Every step in this tutorial is required for making terminal look as the image below.

ZSH & OH-MY-ZSH

sudo apt-get install zsh
sh -c "$(curl -fsSL https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh)"
@javilobo8
javilobo8 / download-file.js
Last active July 1, 2024 23:21
Download files with AJAX (axios)
axios({
url: 'http://localhost:5000/static/example.pdf',
method: 'GET',
responseType: 'blob', // important
}).then((response) => {
const url = window.URL.createObjectURL(new Blob([response.data]));
const link = document.createElement('a');
link.href = url;
link.setAttribute('download', 'file.pdf');
document.body.appendChild(link);
@paulsturgess
paulsturgess / service.js
Last active February 2, 2024 17:24
An example Service class wrapper for Axios
import axios from 'axios';
class Service {
constructor() {
let service = axios.create({
headers: {csrf: 'token'}
});
service.interceptors.response.use(this.handleSuccess, this.handleError);
this.service = service;
}