Skip to content

Instantly share code, notes, and snippets.

View micmmakarov's full-sized avatar

Miša Mаkaröv micmmakarov

View GitHub Profile
@micmmakarov
micmmakarov / game.js
Created August 5, 2020 22:48
Comedy game with flying
// Declaration of constants
levels = [
{
title: "1: You make your coworkers laugh",
score: 0,
max: 30,
emoji: {
bomb: 9,
drink: 30,
@micmmakarov
micmmakarov / describe-lwc-component.js
Last active January 24, 2019 00:11
Scans the WLC component for it's API
// node describe-lwc-component.js ~/path/to/file
String.prototype.padding = function(n, c)
{
var val = this.valueOf();
if ( Math.abs(n) <= val.length ) {
return val;
}
var m = Math.max((Math.abs(n) - this.length) || 0, 0);
var pad = Array(m + 1).join(String(c || ' ').charAt(0));
@micmmakarov
micmmakarov / cherrychecker.rb
Created January 11, 2018 19:03
Script that checks if there're any forgotten cherrypicks
require 'json'
# run from git repo. Make sure to pull first
# EXAMPLE
# cd MY_LIGHTNING_GLOBAL_GIT_FOLDER
# ~/cherrychecker.rb
# ~/cherrychecker.rb email=mmakarov@salesforce.com
# ~/cherrychecker.rb --slack
# ~/cherrychecker.rb compare=212-patch
@micmmakarov
micmmakarov / go_comfy_bot.js
Last active May 22, 2017 20:28
GoComfy bot
warmMySpaceIfSomeoneMadeAColdRequest = function() {
last_request_is_make_cold = $($('.activity-grid .activity-grid-row.ng-scope')[0]).find('img').attr('src').includes('toohot');
if (last_request_is_make_cold) {
$(".btn-warm").click();
console.log("Someone triggered cold request. But don't worry, I'll heat it up for you!");
} else {
console.log('Last request was not the cold request');
}
}
@micmmakarov
micmmakarov / sudoku_ninja.js
Last active February 8, 2017 19:00
Fast Sudoku validator in Javascript via array addresses
/*
Fast JS Sudoku validator implemented in Javascript via array addresses.
Check whether a 9x9 sudoku board is valid.
Sudoku is a game played on a 9x9 grid. The object of the game is to fill in every square on the grid with a number, 1-9, so that:
Every row contains the numbers 1-9
Every column contains the numbers 1-9
@micmmakarov
micmmakarov / throttle_puzzle.rb
Last active October 12, 2016 00:12
Solution for throttle puzzles
class GetShots
def initialize(rate_limit, time_window)
@rate_limit = rate_limit
@time_window = time_window
@calls_count = 0
end
def get_shot(type, params)
@calls_count += 1
@invoked_at ||= Time.now
scoped_key = Keen::ScopedKey.new('KEEN_MASTER_KEY', allowed_operations: ["read"], filters: [{ # master_key should be a variable that contains your Keen master key
'property_name' => 'company.id',
'operator' => 'eq',
'property_value' => current_company.id # current_user.id should be a variable that contains the customer ID
}]).encrypt!
{
message:{
id:1,
direction:"sent",
via_api:false,
type:"FacebookMessage"
},
customer:{
id:16
},
@micmmakarov
micmmakarov / Get likes
Created November 11, 2015 17:12
Analyze person's likes to figure out who's the most active
api_key = "https://developers.facebook.com/tools/explorer"
api = Koala::Facebook::API.new(api_key)
profile = api.get_object("me")
profile = _
profile.keys
@micmmakarov
micmmakarov / helper.coffee
Last active August 29, 2015 14:26
Recursive function to change hash by deep_path
Sonar.changeByArray = (hash, array, newValue) ->
obj = hash
i = 0
while i < array.length - 1
obj = obj[array[i++]]
obj[array[i]] = newValue