Skip to content

Instantly share code, notes, and snippets.

View andersonbosa's full-sized avatar
🥑

Anderson Bosa andersonbosa

🥑
View GitHub Profile
# 0 is too far from ` ;)
set -g base-index 1
# Automatically set window title
set-window-option -g automatic-rename on
set-option -g set-titles on
#set -g default-terminal screen-256color
set -g status-keys vi
set -g history-limit 10000
// ==UserScript==
// @name jQuery Attochator
// @namespace Violentmonkey Scripts
// @match *://*/*
// @grant none
// @version 1.0
// @author anderson "z4b0t" bosa
// @description 2/9/2020, 8:35:28 AM
// ==/UserScript==
@andersonbosa
andersonbosa / rot13.js
Created February 16, 2020 16:19
rot13
/**
* Rot13
*
* @param { String }
* @returns { String }
*/
function rot13(str) {
var input = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz';
var output = 'NOPQRSTUVWXYZABCDEFGHIJKLMnopqrstuvwxyzabcdefghijklm';
function index (x) {
@andersonbosa
andersonbosa / get-set-rewriter.js
Created February 19, 2020 14:08
rewrite getter & setter on an existante Object
// objeto já existente: window.browsingContext.Common.Basket
// propriedade a ter o getter e o setter alteradas: Items
// window.browsingContext.Common.Basket.Items
Object.defineProperty(window.browsingContext.Common.Basket, 'Items', {
get: function () {
console.log('get')
return this
},
set: function (value) {
console.log('set', this, value);
/*
* Return factorial of a integer
* @params {Number} num - integer number
* @returns {Number}
*/
function factorial (num) {
if (!num) {
return
}
if (num === 0) {
/**
* Get task card from given search
* @param {String} searchString - string to find
* @param {String} [where] - selector context.
* default value is .task-title a
* @returns {Object[]}
*/
function getCardId(searchString, where) {
if (!searchString) {
return
@andersonbosa
andersonbosa / string-sanitizer.js
Created June 4, 2020 16:01
Sanitize string by removing accents and special characters
/**
* Sanitize string by removing accents and special characters
*
* @param { String } rawString
* @returns { String }
*/
function sanitizeString(rawString) {
if (typeof rawString !== 'string') {
return;
}
The Rules of Fight Club.
1st RULE: You do not talk about FIGHT CLUB.
2nd RULE: You DO NOT talk about FIGHT CLUB.
3rd RULE: If someone says "stop" or goes limp, taps out the fight is over.
4th RULE: Only two guys to a fight.
var what = function(obj) {
return obj.toString().match(/ (\w+)/)[1];
};
var p;
// Normal obj with constructor.
function Entity() {}
p = new Entity();
console.log("constructor:", what(p.constructor), "name:", p.constructor.name , "class:", what(p));
function interceptNetworkRequests(ee) {
const open = XMLHttpRequest.prototype.open;
const send = XMLHttpRequest.prototype.send;
const isRegularXHR = open.toString().indexOf('native code') !== -1;
// don't hijack if already hijacked - this will mess up with frameworks like Angular with zones
// we work if we load first there which we can.
if (isRegularXHR) {