Skip to content

Instantly share code, notes, and snippets.

@sekmo
sekmo / cursorrules.html
Created May 9, 2024 14:11 — forked from artsparkAI/cursorrules.html
example of cursorrules (ignore .html extension, just for highlighting)
You are a world-class Staff Engineer in React, Typescript, Next.js and Tailwind CSS. Your role is to generate complete,
functional front-end code based on the user's specifications. Adhere to these guidelines:
<CleanCode>
Don't Repeat Yourself (DRY)
Duplication of code can make code very difficult to maintain. Any change in logic can make the code prone to bugs or can
make the code change difficult. This can be fixed by doing code reuse (DRY Principle).
The DRY principle is stated as "Every piece of knowledge must have a single, unambiguous, authoritative representation
@sekmo
sekmo / sidekiq_retry_time.csv
Created May 25, 2023 10:36 — forked from marcotc/sidekiq_retry_time.csv
Sidekiq retry exponential backoff formula times
Retry count Retry Time Total Cumulative Time Total Cumulative Days
0 0:00:00 0:00:00 0.0
1 0:00:16 0:00:16 0.0
2 0:00:31 0:00:47 0.0
3 0:01:36 0:02:23 0.0
4 0:04:31 0:06:54 0.0
5 0:10:40 0:17:34 0.0
6 0:21:51 0:39:25 0.0
7 0:40:16 1:19:41 0.1
8 1:08:31 2:28:12 0.1
@sekmo
sekmo / cloudwatch.css
Last active May 17, 2021 09:20
AWS Cloudwatch dashboard css improvements
// In Cloudwatch dashboards, the widget we add are taking too much space.
// use sth like stylebot to apply it
.SplitPane-module__splitPane___334V0 {
display: flex;
min-height: 0;
}
.react-grid-item {
height: 300px !important;
@sekmo
sekmo / nginx.conf
Created August 8, 2019 21:12 — forked from nrollr/nginx.conf
NGINX config for SSL with Let's Encrypt certs
# UPDATED 17 February 2019
# Redirect all HTTP traffic to HTTPS
server {
listen 80;
listen [::]:80;
server_name www.domain.com domain.com;
return 301 https://$host$request_uri;
}
# SSL configuration
@sekmo
sekmo / .rubocop.yml
Created December 4, 2017 10:37
Rubocop config
inherit_from:
- .rubocop_todo.yml
# inherit_gem:
# rubocop-rails:
# - config/rails.yml
require: rubocop-rspec
AllCops:
DisplayCopNames: true
Exclude:
- db/schema.rb
@sekmo
sekmo / 5_min_alert.sh
Created November 6, 2017 09:42
Alert every 5 minutes
#!/bin/bash
watch -n 300 afplay /System/Library/Sounds/Purr.aiff -v 11 0<&- &>/dev/null &
  • Which is the difference between [1, 2, 3] & [3, 4, 5] and [1, 2, 3] && [3, 4, 5]?
  • Which is the difference between [1, 2, 3] + [3, 4, 5, 6] and [1, 2, 3] << [3, 4, 5, 6]?
  • What do you get with [5, 3, 1, [2, 10]].flatten?

Add some gems to your Gemfile:

group :development, :test do
  gem 'database_cleaner'
  gem 'rspec-rails'
end
group :test do
  gem 'capybara'
  gem 'selenium-webdriver'
@sekmo
sekmo / capybara cheat sheet
Created August 19, 2017 15:36 — forked from zhengjia/capybara cheat sheet
capybara cheat sheet
=Navigating=
visit('/projects')
visit(post_comments_path(post))
=Clicking links and buttons=
click_link('id-of-link')
click_link('Link Text')
click_button('Save')
click('Link Text') # Click either a link or a button
click('Button Value')
@sekmo
sekmo / reverse-string-recursive.rb
Last active June 29, 2017 14:08
Reverse a string in recursive fashion - Ruby
def reverse(string)
if string.size > 1
string[-1] + reverse(string[0..-2])
else
string
end
end
puts reverse "Francesco"