Skip to content

Instantly share code, notes, and snippets.

View GabeDuarteM's full-sized avatar

Gabe Duarte GabeDuarteM

View GitHub Profile
@GabeDuarteM
GabeDuarteM / UserInfo.tsx
Last active August 30, 2020 02:23
React context utils
import React from "react";
import createContext from './createContext';
const [useUserInfoContext, UserInfoProviderInternal] = createContext<
string
>();
export { useUserInfoContext };
export const UserInfoProvider: React.FC = ({ children }) => {
@GabeDuarteM
GabeDuarteM / paginateList.ts
Last active March 19, 2020 17:53
utilities
function paginateList<T>(list: T[], currentPage: number, totalPerPage: number) {
const start = (currentPage - 1) * totalPerPage;
const end = start + totalPerPage;
const pageList = list.slice(start, end);
return pageList;
}
@GabeDuarteM
GabeDuarteM / bash-tldr.sh
Last active January 21, 2020 16:56
basic bash stuff that I'm tired of searching whenever I need ¯\_(ツ)_/¯
# return a value in a function
function returnTrue() {
echo true
}
# pass arguments to a function
#
# usage:
# $ greeter "Gabriel"
# > "Hello Gabriel"
@GabeDuarteM
GabeDuarteM / show-page-created-global-variables.js
Created December 25, 2019 22:43
Displays all global variables created by the current page.
(() => {
const iframe = document.createElement('iframe')
iframe.style.display = 'none'
document.body.appendChild(iframe)
const currentWindow = Object.getOwnPropertyNames(window)
const results = currentWindow.filter(prop => !iframe.contentWindow.hasOwnProperty(prop))
console.log(results)
@GabeDuarteM
GabeDuarteM / twitch-chest-autoclick.js
Created December 23, 2019 01:27
twitch.tv chest autoclick
(() => {
const chestButtonSelector = '.claimable-bonus__icon'
if (window.clearTwitchChestInterval) {
window.clearTwitchChestInterval()
}
const interval = setInterval(() => {
const chestButton = document.querySelector(chestButtonSelector)
if (chestButton) {
@GabeDuarteM
GabeDuarteM / cygwin.md
Last active April 17, 2018 06:12
Cygwin
@GabeDuarteM
GabeDuarteM / Visual Studio Code.md
Last active June 10, 2019 14:02
Integrating cmder

Cmder config

Create a file named initInExternalTerminal.bat on cmder's root, containing the following:

@echo off
REM The following CMDER_ROOT must have the complete path to the cmder folder, 
REM like "C:\Users\gabriel\Documents\Cmder"
SET CMDER_ROOT=PATH/TO/THE/CMDER/FOLDER
"%CMDER_ROOT%\vendor\init.bat"
@GabeDuarteM
GabeDuarteM / README.md
Created January 10, 2018 12:41
Integrate Hyper with Cmder
  • create a .bat file
@echo off
REM ### Below on CMDER_ROOT, substitute 'C:\Cmder' with the path to your CMDER root (the one that contains Cmder.exe) ###
SET CMDER_ROOT=C:\Cmder 
"%CMDER_ROOT%\vendor\init.bat"
  • open hyper's config, and on shellArgs, fill with an array, with the first value being: "/K", and the second being the path to the file you created above