Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View tuomasj's full-sized avatar

Tuomas Jomppanen tuomasj

View GitHub Profile
@tuomasj
tuomasj / ruby_on_rails.yml
Created May 6, 2022 09:15
Github Actions for CI -- Ruby on Rails, PostgreSQL, Redis, Elasticsearch in May 2022
name: CI
on: [push, pull_request]
jobs:
test:
runs-on: ubuntu-latest
services:
db:
image: postgres
ports: ['5432:5432']
env:
@tuomasj
tuomasj / nhl_games_tonight.rb
Created September 21, 2018 20:28
Fetch NHL game scores and post the results on a Telegram channel
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
tuomasj / .bash_aliases
Created October 22, 2017 08:30
Bash shell 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
tuomasj / patch-edid.rb
Created September 14, 2017 08:34
Create display override file to force Mac OS X to use RGB mode for Display
#!/usr/bin/ruby
# Create display override file to force Mac OS X to use RGB mode for Display
# see http://embdev.net/topic/284710
#
# Update 2013-06-24: added -w0 option to prevent truncated lines
#
# original source: https://embdev.net/topic/284710#3027030 (by Andreas Schwarz)
require 'base64'
@tuomasj
tuomasj / Preferences.sublime-settings
Last active January 28, 2017 11:32
My Sublime Text 3 settings file
// 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,
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
else
local ansi=45
fi
@tuomasj
tuomasj / .rspec
Created February 15, 2014 20:59 — forked from coreyhaines/.rspec
--colour
-I app
@tuomasj
tuomasj / activation_email_spec.rb
Created November 21, 2013 15:49
Testing Activation Emails with Capybara, RSpec and Custom Matcher. I wrote blog post which is here: http://tuom.as/2013/11/20/testing-activation-emails-with-capybara-rspec-and-custom-matcher.html
require 'spec_helper'
describe "Activation Email" do
it "confirms the email when user clicks the confirmation link on activation email" do
register_new_user("john.smith@example.com", "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.")
end
@tuomasj
tuomasj / have_link_endswith.rb
Last active December 27, 2015 11:29
Have a link that ends with specific text, Capybara matcher