Skip to content

Instantly share code, notes, and snippets.

@tigris
tigris / datetime.rb
Created February 29, 2024 04:36
Ruby DateTime#next_year on leap days
#!/usr/bin/env ruby
require 'date'
now = DateTime.now
yesterday = now - 1
puts "Now: #{now}"
puts "Yesterday: #{yesterday}"
puts "======"
@tigris
tigris / kwargs-splats.rb
Created March 15, 2023 05:30
kwargs and splats
#!/usr/bin/env ruby
##### KWARGS
def kwargs(foo:, bar:)
puts "foo: #{foo}"
puts "bar: #{bar}"
end
@tigris
tigris / ruby2.6.7.log
Last active April 29, 2021 11:16
ruby-install ruby 2.6.7
>>> Installing ruby 2.6.7 into /Users/danial.pearce/.rubies/ruby-2.6.7 ...
>>> Installing dependencies for ruby 2.6.7 ...
Warning: automake 1.16.3_1 is already installed and up-to-date.
To reinstall 1.16.3_1, run:
brew reinstall automake
Warning: bison 3.7.6 is already installed and up-to-date.
To reinstall 3.7.6, run:
brew reinstall bison
Warning: [email protected] 1.1.1k is already installed and up-to-date.
To reinstall 1.1.1k, run:
@tigris
tigris / games.txt
Created October 1, 2020 05:17
List of xbox games on gamepass
a plague tale: innocence
absolver
ace combat™ 7: skies unknown
afterparty
age of wonders: planetfall
alan wake
alien: isolation
alvastia chronicles
ark: survival evolved
astroneer
@tigris
tigris / clownformation.yaml
Created December 4, 2019 23:49
Cloudfront S3 website
---
AWSTemplateFormatVersion: 2010-09-09
Parameters:
Certificate:
Type: String
Hostname:
Type: String
Resources:
Bucket:
Type: AWS::S3::Bucket
@tigris
tigris / RACK_ENV-in-rails
Last active February 15, 2018 00:39
Puma ignores RACK_ENV inside a rails app?
#-❯ docker run --rm -it -e RACK_ENV=production rails bash -c 'rails new test-app && cd test-app && puma'
create
create README.md
create Rakefile
create config.ru
create .gitignore
create Gemfile
create app
create app/assets/config/manifest.js
create app/assets/javascripts/application.js
@tigris
tigris / untappd.rb
Created November 11, 2016 03:47
Scrape untappd checkins
#!/usr/bin/env ruby
require 'json'
require 'open-uri'
class UntappdApi
attr_accessor :access_token
def url_for(user_id, max_id)
"https://api.untappd.com/v4/user/checkins/#{user_id}?access_token=#{access_token}&max_id=#{max_id}&limit=50"
@tigris
tigris / brownlow.rb
Created September 26, 2016 09:18
Convert game stats to brownlow votes
def brownlow_total(s)
disposals = s[:kicks] + s[:handballs]
disposal_modifier = case
when disposals > 40; then 10
when disposals > 30; then 5
when disposals > 20; then 1
else 0
end
marks_modifier = case
@tigris
tigris / .ebextensions__02_nginx_fix.config
Created January 18, 2016 08:03
Fix for elasticbeanstalk puma and serving of static files from the public folder
---
container_commands:
10_copy:
command: sudo cp -f config/nginx.conf /etc/nginx/conf.d/webapp.conf
20_reload:
command: sudo service nginx reload
@tigris
tigris / README.md
Created July 21, 2014 10:30
nokogiri 1.6.3 install error OSX

System details

OSX -> 10.9.3

Homebrew

$ brew -v
Homebrew 0.9.5

libxslt