This file contains hidden or 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
| # -*- mode: snippet -*- | |
| # name: debug | |
| # key: db | |
| # -- | |
| require ` (let ((version (shell-command-to-string "rbenv version"))) | |
| (if (string-match-p "^2" version) | |
| (concat "'byebug';byebug") | |
| (concat "'ruby-debug';debugger"))) | |
| ` | |
| $0 |
This file contains hidden or 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
| #include <assert.h> | |
| #include <stdarg.h> | |
| #include <stdbool.h> | |
| #include <stdio.h> | |
| #include <stdlib.h> | |
| #include <string.h> | |
| #include <unistd.h> | |
| enum type { | |
| NIL, |
This file contains hidden or 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 'sinatra/base' | |
| require 'rollbar' | |
| require 'rollbar/middleware/sinatra' | |
| Rollbar.configure do |config| | |
| config.access_token = 'bfec94a1ede64984b862880224edd0ed' | |
| config.enabled = true | |
| end | |
| class App < Sinatra::Base |
This file contains hidden or 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
| # config/environment.rb | |
| require File.expand_path('../application', __FILE__) | |
| require File.expand_path('../rollbar', __FILE__) | |
| begin | |
| Rails.application.initialize! | |
| rescue Exception => e | |
| Rollbar.error(e) | |
| raise |
This file contains hidden or 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
| IGNORED_IPS = [] | |
| class Rollbar::Notifier | |
| def report(*args) | |
| return if ignore_request? | |
| super(*args) | |
| end | |
| def ignore_request? |
This file contains hidden or 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 'rollbar' | |
| require 'rollbar/delay/delayed_job' | |
| require 'delayed/backend/active_record' | |
| module Rollbar | |
| MAX_TEXT_SIZE = 65_535 # Max size for text columns in MySQL | |
| class DelayedHandlerTooLarge < StandardError | |
| end | |
| end |
This file contains hidden or 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
| F(T|¬D) = P(¬D|T) * P(T) / P(¬D) | |
| P(¬D|T) = P(¬D) ??? | |
| F(T|¬D) = P(¬D) * P(T) / P(¬D) = P(T) = 0.99 ??? |
This file contains hidden or 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
| from Cryptodome.Cipher import AES | |
| KEY = '30c732878042aa2ea569efc1c42ab17d' | |
| def gcm_decrypt(key, encrypted_data): | |
| nonce, tag, ciphertext = encrypted_data[:16], encrypted_data[16:32], encrypted_data[32:] | |
| cipher = AES.new(key, AES.MODE_GCM, nonce) | |
| return cipher.decrypt_and_verify(ciphertext, tag) |
This file contains hidden or 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
| ################## | |
| function foo () { | |
| console.log("Simple function call"); | |
| console.log(this === window); | |
| } | |
| foo(); | |
| console.log(this === window) | |
| ################## |
This file contains hidden or 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
| /** | |
| * Can you explain the differences between all those ways | |
| * of passing function to a component? | |
| * | |
| * What happens when you click each of the buttons? | |
| */ | |
| class App extends React.Component { | |
| constructor() { | |
| super(); |