This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Declaration of constants | |
levels = [ | |
{ | |
title: "1: You make your coworkers laugh", | |
score: 0, | |
max: 30, | |
emoji: { | |
bomb: 9, | |
drink: 30, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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)); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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'); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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! |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
message:{ | |
id:1, | |
direction:"sent", | |
via_api:false, | |
type:"FacebookMessage" | |
}, | |
customer:{ | |
id:16 | |
}, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
api_key = "https://developers.facebook.com/tools/explorer" | |
api = Koala::Facebook::API.new(api_key) | |
profile = api.get_object("me") | |
profile = _ | |
profile.keys |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sonar.changeByArray = (hash, array, newValue) -> | |
obj = hash | |
i = 0 | |
while i < array.length - 1 | |
obj = obj[array[i++]] | |
obj[array[i]] = newValue |
NewerOlder