Skip to content

Instantly share code, notes, and snippets.

View kalelc's full-sized avatar

Andres Colonia kalelc

View GitHub Profile
@coderberry
coderberry / cloc_pr.rb
Last active January 30, 2024 15:56
Calculate the diff of a PR
#!/usr/bin/env ruby
# Count lines of code in a pull request
# Usage:
# ./b/cloc_pr 22621
#
# Code: +1212 / -208
# Blank Lines: +241 / -18
# Files: +17 / -0
# Modified Files: 38
@swalkinshaw
swalkinshaw / tutorial.md
Last active November 13, 2023 08:40
Designing a GraphQL API
@osulyanov
osulyanov / config.yml
Last active November 30, 2022 23:58
Circle CI workflows config to test and deploy Ruby on Rails application with PostgreSQL database. Test with Rspec, precompile assets then deploy with Capistrano.
# Ruby CircleCI 2.0 configuration file
#
# Check https://circleci.com/docs/2.0/language-ruby/ for more details
#
defaults: &defaults
working_directory: ~/repo
docker:
- image: circleci/ruby:2.4.1-node-browsers
environment:
@jodosha
jodosha / request_id.rb
Created December 4, 2017 20:17
Ruby benchmark `SecureRandom.hex(16)` vs `SecureRandom.uuid`
#!/usr/bin/env ruby
# frozen_string_literal: true
require "benchmark/ips"
require "securerandom"
Benchmark.ips do |x|
x.report("hex(16)") { SecureRandom.hex(16) }
x.report("uuid") { SecureRandom.uuid }
x.compare!
@doitian
doitian / rails-cookie-decrypt.go
Created September 23, 2017 07:30
rails session encrypt
@PavloBezpalov
PavloBezpalov / 1. ELK.install
Last active January 5, 2024 16:14
ELK Stack with Rails (Elasticsearch, Logstash, Kibana) on Ubuntu VPS
INSTALL JAVA
$ sudo apt-get update && sudo apt-get install default-jre
INSTALL ELASTIC SEARCH https://www.elastic.co/guide/en/elasticsearch/reference/current/setup-repositories.html
$ wget -qO - https://packages.elastic.co/GPG-KEY-elasticsearch | sudo apt-key add -
$ echo "deb https://packages.elastic.co/elasticsearch/2.x/debian stable main" | sudo tee -a /etc/apt/sources.list.d/elasticsearch-2.x.list
$ sudo apt-get update && sudo apt-get install elasticsearch
$ sudo update-rc.d elasticsearch defaults 95 10
$ sudo service elasticsearch restart
$ sudo service elasticsearch status
@tuxfight3r
tuxfight3r / vim-shortcuts.md
Last active July 21, 2024 15:55
VIM SHORTCUTS

VIM KEYBOARD SHORTCUTS

MOVEMENT

h        -   Move left
j        -   Move down
k        -   Move up
l        -   Move right
$        -   Move to end of line
0        -   Move to beginning of line (including whitespace)
@speric
speric / poodir-notes.md
Last active May 15, 2024 13:39
Notes From "Practical Object-Oriented Design In Ruby" by Sandi Metz

Chapter 1 - Object Oriented Design

The purpose of design is to allow you to do design later, and it's primary goal is to reduce the cost of change.

SOLID Design:

  • Single Responsibility Principle: a class should have only a single responsibility
  • Open-Closed Principle: Software entities should be open for extension, but closed for modification (inherit instead of modifying existing classes).
  • Liskov Substitution: Objects in a program should be replaceable with instances of their subtypes without altering the correctness of that program.
  • Interface Segregation: Many client-specific interfaces are better than one general-purpose interface.
-- place this file in
-- $(brew --prefix highlight)/share/highlight/themes/yawn.theme
Description = "Yawn"
Default = { Colour="#000000" }
Canvas = { Colour="#ffffff" }
Number = { Colour="#812024" }
Escape = { Colour="#696969" }
String = { Colour="#006124" }
@btoone
btoone / deploy.rb
Created August 17, 2011 14:48
Example Capistrano configuration for multi stage deployment
# app/config/deploy.rb
# Most of the changes specific to your environment will be set in
# the `app/config/deploy/[env].rb` files.
# define multiple deployments
set :stages, %w(production staging)
set :default_stage, "staging"