Skip to content

Instantly share code, notes, and snippets.


Tuomas Jomppanen tuomasj

View GitHub Profile
tuomasj / ruby_on_rails.yml
Created May 6, 2022
Github Actions for CI -- Ruby on Rails, PostgreSQL, Redis, Elasticsearch in May 2022
View ruby_on_rails.yml
name: CI
on: [push, pull_request]
runs-on: ubuntu-latest
image: postgres
ports: ['5432:5432']
tuomasj / nhl_games_tonight.rb
Created Sep 21, 2018
Fetch NHL game scores and post the results on a Telegram channel
View nhl_games_tonight.rb
require 'date'
require "open-uri"
require 'json'
# This is just one big file, because it's easy to copy&paste (a.k.a. deploy)
# this script on a cheap VPN and set up a cronjob to run this once per day.
# Example output with Telegram markdown formatting
# shows the winning team and players who have goals or assists
tuomasj / .bash_aliases
Created Oct 22, 2017
Bash shell aliases
View .bash_aliases
# Assuming that ~/.bash_aliases has the aliases defined
# These work on Bash, not sure what happens with other shells
# Run previous command
alias r='fc -s'
# Open .vimrc
alias vimrc="vim ~/.vimrc"
# Reload aliases
tuomasj / patch-edid.rb
Created Sep 14, 2017
Create display override file to force Mac OS X to use RGB mode for Display
View patch-edid.rb
# Create display override file to force Mac OS X to use RGB mode for Display
# see
# Update 2013-06-24: added -w0 option to prevent truncated lines
# original source: (by Andreas Schwarz)
require 'base64'
tuomasj / Preferences.sublime-settings
Last active Jan 28, 2017
My Sublime Text 3 settings file
View Preferences.sublime-settings
// Preferences.sublime-settings
// Sublime Text 3, 28.1.2017
"auto_complete": true,
"auto_complete_commit_on_tab": true,
"auto_complete_with_fields": true,
"bold_folder_labels": true,
"default_encoding": "UTF-8",
"detect_indentation": true,
View git-colors.bash
function _git_prompt() {
local git_status="`git status -unormal 2>&1`"
if ! [[ "$git_status" =~ Not\ a\ git\ repo ]]; then
if [[ "$git_status" =~ nothing\ to\ commit ]]; then
local ansi=42
elif [[ "$git_status" =~ nothing\ added\ to\ commit\ but\ untracked\ files\ present ]]; then
local ansi=43
local ansi=45
tuomasj / activation_email_spec.rb
Created Nov 21, 2013
Testing Activation Emails with Capybara, RSpec and Custom Matcher. I wrote blog post which is here:
View activation_email_spec.rb
require 'spec_helper'
describe "Activation Email" do
it "confirms the email when user clicks the confirmation link on activation email" do
register_new_user("", "adobe password", "adobe password")
activation_token = User.last.activation_code
expect( open_last_email.body).to have_link_with_endswith(activation_token)
visit activation_path(activation_token)
expect(page).to have_content( "Your email has been confirmed.")
tuomasj / have_link_endswith.rb
Last active Dec 27, 2015
Have a link that ends with specific text, Capybara matcher
View have_link_endswith.rb