Skip to content

Instantly share code, notes, and snippets.

@hahmed
hahmed / structs_test.rb
Last active September 6, 2023 08:05
Structs vs classes
# SORBET_RUNTIME_DEFAULT_CHECKED_LEVEL=never RUBY_YJIT_ENABLE=1 ruby structs_test.rb
# SORBET_RUNTIME_DEFAULT_CHECKED_LEVEL=never ruby structs_test.rb
# SORBET_RUNTIME_DEFAULT_CHECKED_LEVEL=always ruby structs_test.rb
require "bundler/inline"
gemfile(true) do
source "https://rubygems.org"
git_source(:github) { |repo| "https://github.com/#{repo}.git" }
@hahmed
hahmed / template.rb
Created February 27, 2023 22:59
set the console to pry
initializer 'myveryfirstinitializer.rb', <<-CODE
Rails.application.configure do
console do
require "pry"
config.console = Pry
require "awesomecompany"
end
end
CODE
@hahmed
hahmed / output.txt
Created December 21, 2022 22:22
Build and install yjit fails because rust
ruby master % ./configure --enable-yjit --prefix=$HOME/.rubies/ruby-yjit --disable-install-doc
make -j install
checking for ruby... /Users/haroon/.rubies/ruby-2.6.5/bin/ruby
tool/config.guess already exists
tool/config.sub already exists
checking build system type... x86_64-apple-darwin21.6.0
checking host system type... x86_64-apple-darwin21.6.0
checking target system type... x86_64-apple-darwin21.6.0
checking for cl.exe... no
checking for clang... clang
@hahmed
hahmed / Gemfile
Created June 26, 2020 07:40 — forked from dhh/Gemfile
HEY's Gemfile
ruby '2.7.1'
gem 'rails', github: 'rails/rails'
gem 'tzinfo-data', '>= 1.2016.7' # Don't rely on OSX/Linux timezone data
# Action Text
gem 'actiontext', github: 'basecamp/actiontext', ref: 'okra'
gem 'okra', github: 'basecamp/okra'
# Drivers
data:image/gif;base64,R0lGODlhyADIAPf/ACYMAysVBS8VBTAXBTAbCDQWBTYgDDcbCTkmETsvGEQtF0UeCkkjDkk0HUk5IUomEUtAKE4tFlEnEVJDKlQpE1gyGlg4IVhMM1otFFpCKl42HmAtEGBNNWBVPGQ/JmVFLGY5H2ZjR2dcQmk1FGouC2pNNGpVPG9CJXFFKnFHLnFVPHFbQnFjSXFxVHJQN3NLMnOIZnc4D3hGJXhIKnhJLHhJL3hWPHhbQnhiSHhqT3h1WHlKMXlNNH5KLH5MMX5PNH6KaoFKJoFaQII/EoJeQ4KXdoNPLINRMYNRNINTNoNVOYNwVYRZO4RhRYRkSoVHGoiJaolqTYl3Wol8YImohYxTLIxXN4xkSI2XeI5JF45dPI5wVI9fQZFPHZJrTZNYMpNkQpOEZpOLbZRlR5ZyVJdfNpd5W5hWJZhqR5htTpliO5qnh5xTGp1XIJ1dK52TdJ2cfJ9pQ59sSp9yUaB4WKFxTqF8XqGNbqJwSaJ3U6OJZ6SDY6a1ladfJKdjL6hqN6h3Uqh8WqlxRqmnhq13S618V6+VdbCGY7FmK7GCWbGEXrJtNbKKZrKefrN+VbOQbLVsLradeLaxkra7m7dyN7d3RLikfrl9SbmEV7mWdLmoh7nIqLqJYbqPar50NL+ZdL+decB3OMCIWcCOZcGETcKXb8V8OsV+QcWVacaac8eGT8ejfsiDQsiNVsiQY8ieecmogsrStMu4mcvFpMyykM2EQM2FRs2OVM2tis6JSM+XZdCec9GjedGogdKHQ9Kda9SNTdWLRtWMSdWUVdaRTdieatqidNuQStuthNzNrd2TTN2TT96VT96dX9+YVOCYUOCpd+C4k+DCnOGcVeGfZ+KlauWaUuacVuedU+eeVeiyg+mgVumhX+qjWOqoZ+ylX+2kWe3PrO+oX++vdfClWvCpZvDEmfKoW/KvafOrX/OtZvSpXfWsYPawZ/a2c/exaPm1bfq6dfrCgfy+eGdxUq3KqM
@hahmed
hahmed / shipping.md
Created April 30, 2020 15:38
shipping

Ship it

@hahmed
hahmed / coding.md
Created April 30, 2020 15:35
coding

Coding

@hahmed
hahmed / github-desktop.md
Created December 31, 2018 23:05
Clone rails/rails issue

Cloning into '/Users/haroon/projects/rails'... remote: Enumerating objects: 128, done.
remote: Counting objects: 0% (1/128)
remote: Counting objects: 1% (2/128)
remote: Counting objects: 2% (3/128)
remote: Counting objects: 3% (4/128)
remote: Counting objects: 4% (6/128)
remote: Counting objects: 5% (7/128)
remote: Counting objects: 6% (8/128)
remote: Counting objects: 7% (9/128)

@hahmed
hahmed / congif.yml
Created May 23, 2018 11:46
Circle ci setup
# Ruby CircleCI 2.0 configuration file
#
# Check https://circleci.com/docs/2.0/language-ruby/ for more details
#
version: 2
jobs:
build:
docker:
# specify the version you desire here
- image: circleci/ruby:2.4.1-node-browsers
@hahmed
hahmed / test.rb
Last active January 16, 2018 14:37
Finding unique pairs in array
# Write a function which, given an array of integers of value greater or equal to 0, returns all unique pairs which sum to 100.
#
# Example data:
#
# input = [0, 1, 100, 99, 0, 10, 90, 30, 55, 33, 55, 75, 50, 51, 49, 50, 51, 49, 51]
# output = [[1,99], [0,100], [10,90], [51,49], [50,50]]
class Test
def remove_used(match, array)
array.delete_at array.index match[0]