Skip to content

Instantly share code, notes, and snippets.

View rrmesquita's full-sized avatar
🏠
Working from home

Rodrigo Mesquita rrmesquita

🏠
Working from home
  • Rio de Janeiro
View GitHub Profile
@rrmesquita
rrmesquita / navall.js
Created May 24, 2018 06:45
Mobile Multi-Level Menu
(function($) {
$.fn.navall = function() {
let namespace = $(this).attr('class');
let lvl = $('.' + namespace + ' [class*="level-"]');
lvl.children('.title').click(function(){
$(this).parent().toggleClass('active');
});
@rrmesquita
rrmesquita / br-phone-format.js
Created November 22, 2018 15:52
Algorithm to validate brazillian phone numbers using jquery-mask-plugin
/**
* Format phone numbers where an ninth digit is optional
*/
(function(){
let phoneInputs = [ '[name="phone"]' ];
let phoneMaskBehavior = function (val) {
return val.replace(/\D/g, '').length === 11 ? '(00) 00000-0000' : '(00) 0000-00009';
};
@rrmesquita
rrmesquita / cloudSettings
Last active September 20, 2020 17:25
Visual Studio Code Settings Sync Gist
{"lastUpload":"2020-09-20T17:25:22.873Z","extensionVersion":"v3.4.3"}
@rrmesquita
rrmesquita / getMostFrequent.js
Last active August 18, 2019 02:02
Get the most frequent element from array of objects
/**
* Filter an array of objects to get the most frequent element
*
* @param {Object[]} arr The array of objects
* @param {String} keyname The name that will be used to filter the objects
* @returns {Array}
*/
getMostFrequent(arr, keyname) {
// Store how many times each element appears
let lookup = {};
@rrmesquita
rrmesquita / invalid_empty-string
Created August 24, 2019 00:42
IonPrev Challenge upload examples
user_id,company_id,event_name,action,date_time
1,1,login,put,2019-04-01 11:03:50
2,2,budget,put,2019-04-02 12:03:50
3,3,,get,2019-04-01 11:05:50
4,3,,,2019-04-01 11:07:50
4,3,budget,get,
5,3,budget,put,2019-04-01 11:10:50
10,1,dashboard,get,2019-04-01 12:05:50
@rrmesquita
rrmesquita / _configs.cfg
Last active September 28, 2023 22:18
CS:GO Configuration Files
// General
cl_crosshair_sniper_width "2";
cl_draw_only_deathnotices "0";
cl_hud_radar_scale "1.15";
cl_radar_always_centered "0";
cl_radar_icon_scale_min "1";
cl_radar_rotate "1";
cl_radar_scale "0.275";
cl_radar_square_with_scoreboard "1";
@rrmesquita
rrmesquita / metric.sh
Created February 23, 2024 23:00
Average response time
#!/usr/bin/env bash
# calculate the average response time of the server for a given url received as an argument.
# Number of requests to make
requests=$1
# URL to make requests to
url=$2