Skip to content

Instantly share code, notes, and snippets.


Filip Bartuzi Bartuz

View GitHub Profile
Bartuz / component.jsx
Last active Jul 7, 2020
helper to test How to unit test Reaptcha invisible recaptcha google jest enzyme
View component.jsx
const Component = ({ onSuccess, onError, onExpire }) => {
const recapchaRef = useRef(null);
return (
onRender={() => recapchaRef.current.execute()}
victornpb / deleteDiscordMessages.js
Last active Nov 18, 2021
Delete all your messages from DM or Channel in Discord
View deleteDiscordMessages.js
This file is now hosted here:
View stock-options.txt
# do poczytania
khamidou / verify.rb
Last active Sep 28, 2021
Verifying Nylas webhooks using Ruby
View verify.rb
require 'openssl'
# verify_webhook: check that a webhook was sent by a Nylas server.
# params:
# - request: the request object you get from Rails,
# - nylas_app_secret: your app secret.
def verify_webhook(request, nylas_app_secret)
digest ='sha256')
data =
digest = OpenSSL::HMAC.hexdigest(digest, nylas_app_secret, data)
solnic / am_dry_validation_1.rb
Last active Jul 22, 2021
dry-validation vs activemodel
View am_dry_validation_1.rb
require 'benchmark/ips'
require 'active_model'
require 'virtus'
require 'dry-validation'
require 'dry/validation/schema/form'
class User
include ActiveModel::Validations
include Virtus.model
Bartuz /
Created Nov 9, 2015 — forked from JunichiIto/
List of alias matchers in RSpec 3

This list is based on aliases_spec.rb.

You can see also Module: RSpec::Matchers API.

matcher aliased to description
a_truthy_value be_truthy a truthy value
a_falsey_value be_falsey a falsey value
be_falsy be_falsey be falsy
a_falsy_value be_falsey a falsy value
Bartuz / application_controller_spec.rb
Created Oct 23, 2015
before/after filters/actions rspec testing. Credits to:
View application_controller_spec.rb
# spec/controllers/application_controller_spec.rb
require 'spec_helper'
describe ApplicationController do
describe 'class' do
it { has_before_filters(:authenticate_user) }
yesvods / gist:51af798dd1e7058625f4
Created Aug 15, 2015
Merge Arrays in one with ES6 Array spread
View gist:51af798dd1e7058625f4
const arr1 = [1,2,3]
const arr2 = [4,5,6]
const arr3 = [...arr1, ...arr2] //arr3 ==> [1,2,3,4,5,6]
paneq / bench.rb
Last active Dec 11, 2016
cost of using exceptions for control flow compared to one SQL statement (ruby 2.1.4, rails 4.1.7, sqlite) for . Development mode executed in rails console.
View bench.rb
require 'benchmark'
ActiveRecord::Base.logger = nil
Benchmark.bmbm do |bench|"SQL query") do
1000.times { Whatever.count }
end"exception hit") do
View capybara cheat sheet
=Clicking links and buttons=
click_link('Link Text')
click('Link Text') # Click either a link or a button
click('Button Value')