This file contains 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
#!/bin/bash | |
# Usage: | |
# ./resize_and_convert.sh ~/Desktop/folder-with-images | |
# Check if the correct number of arguments is provided | |
if [ "$#" -ne 1 ]; then | |
echo "Usage: $0 source_path" | |
exit 1 | |
fi |
This file contains 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 'redis' | |
require 'digest' | |
class RateLimit | |
def initialize(app) | |
@app = app | |
end | |
def call(env) | |
redis = Redis.new |
This file contains 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 'ezmetrics' | |
require 'benchmark' | |
require 'active_support/time' | |
def write_metrics(start, redis, seconds) | |
redis.flushdb | |
seconds.times do |i| | |
second = start - i | |
payload = { |
This file contains 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
➜ work sh siege.sh | |
-------------------------------ELIXIR-------------------------------- | |
** SIEGE 3.0.5 | |
** Preparing 600 concurrent users for battle. | |
The server is now under siege... | |
Lifting the server siege... done. | |
Transactions: 66070 hits | |
Availability: 100.00 % | |
Elapsed time: 9.82 secs |
This file contains 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
# -c: 10 concurrent requests | |
# -r: 2 attempts | |
# -b: benchmark mode | |
# -v: verbose mode | |
# -H: header | |
# GET | |
siege -c 10 \ | |
-r 2 \ | |
-b \ |
This file contains 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
ruby -e 'p `git status`.split("\n").select {|l|l.match("modified")}.map {|l|l.gsub(/\tmodified:\s+|app\/|\.rb/, "")}.delete_if {|l|l.match(/scss|yml|haml|_spec/)}.map {|l|"spec/#{l}_spec.rb"}.join(" ")' | xargs echo | xargs rspec |
This file contains 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
[ | |
{ | |
"name": "Afghanistan", | |
"code": "AF" | |
}, | |
{ | |
"name": "Albania", | |
"code": "AL" | |
}, | |
{ |
This file contains 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
class SimpleSerializer < ActiveModel::Serializer | |
attributes :name, :code | |
end |
This file contains 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
### Ruby | |
Refactoring Ruby Edition | |
Ruby Best Practices | |
The RSpec Book | |
Design Patterns in Ruby | |
### Ruby on Rails | |
The Rails Way |