Skip to content

Instantly share code, notes, and snippets.

View peteryates's full-sized avatar
🪶

Peter Yates peteryates

🪶
View GitHub Profile
@peteryates
peteryates / common_steps.rb
Last active February 8, 2019 10:05
Interacting with checkboxes and radio buttons
Given("I am on the {string} page") do |string|
path_for(string).tap do |p|
visit(p)
expect(page.current_path).to eql(p)
end
make_inputs_opaque if opaquify_inputs?
end
@peteryates
peteryates / guide.md
Last active February 12, 2026 03:53
How to stop adverts appearing on your Samsung TV

I'm getting adverts in my TV's UI, help!

Samsung's otherwise excellent 2016 range of UHD TVs received an update that added advertisements to the UI. This has been complained about at great length on Samsung's forums and repeatedly, Samsung have refused to add an option to remove them.

The ads interrupt the clean UI of the TV and are invasive. Here's an example of how they look:

one two

This guide was originally posted on Samsung's TV forums but unfortunately, that site is a super-slow and barely accessible unusable mess.

@peteryates
peteryates / input.rb
Last active June 29, 2025 11:42
Words that add up to 100 (based on the character index)
alphabet = ('a'..'z').each_with_index.with_object({}) { |(letter, i), hash| hash[letter] = i+1 }
puts File
.open('/usr/share/dict/words')
.each_line
.map(&:chomp)
.reject { |word| word =~ /[^A-Za-z]/ }
.select { |word| word.downcase.chars.inject(0) { |n, char| n + alphabet[char] } == 100 }
# Original: https://gist.github.com/otaviomedeiros/1950961
# Updated for new RSpec syntax
RSpec::Matchers.define :alias_from do |alias_method|
match do |subject|
begin
subject.send(alias_method)
rescue NoMethodError
raise "expected alias_method from #{alias_method} to #{@original_method} but #{alias_method} is not defined"
end
# select * from public_holidays limit 20;
id | name | date | notes | bunting | country_id | country_region_id | created_at | updated_at
----+---------------------------------------+------------+----------------+---------+------------+-------------------+----------------------------+----------------------------
30 | New Year’s Day | 2012-01-02 | Substitute day | t | 236 | 1 | 2014-08-20 09:08:59.079501 | 2014-08-20 09:08:59.079501
31 | Easter Monday | 2012-04-09 | | t | 236 | 1 | 2014-08-20 09:08:59.081972 | 2014-08-20 09:08:59.081972
32 | Spring bank holiday | 2012-06-04 | Substitute day | t | 236 | 1 | 2014-08-20 09:08:59.084068 | 2014-08-20 09:08:59.084068
33 | Summer bank holiday | 2012-08-27 | | t | 236 |

Keybase proof

I hereby claim:

  • I am peteryates on github.
  • I am peteryates (https://keybase.io/peteryates) on keybase.
  • I have a public key whose fingerprint is A846 F177 4703 66B2 FDD0 5B03 F5A9 E8AD 2A5C 54A1

To claim this, I am signing this object:

@peteryates
peteryates / delegate_matcher.rb
Last active August 29, 2015 13:57 — forked from pcreux/delegate_matcher.rb
Updated to new RSpec syntax
# RSpec matcher to spec delegations.
#
# Usage:
#
# describe Post do
# it { expect(subject).to delegate(:title).to(:name) } # post.title => post.name
# it { expect(subject).to delegate(:month).to(:created_at) } # post.month => post.created_at
# it { expect(subject).to delegate(:author_name).to(:author, :name) } # post.author_name => post.author.name
# end
@peteryates
peteryates / mecab.spec
Created February 12, 2014 09:29 — forked from hylom/mecab.spec
%define name mecab
%define version 0.996
%define release el6.4
Summary: Yet Another Part-of-Speech and Morphological
Name: %{name}
Version: %{version}
Release: %{release}
Source0: https://mecab.googlecode.com/files/mecab-%{version}.tar.gz
License: GPL/LGPL/BSD
%define name mecab-ipadic
%define ver 2.7.0
%define date 20070801
%define release el6.4_1
Summary: IPA dictionary for MeCab
Summary(ja): MeCab用のIPA辞書
Name: %{name}
Version: %{ver}.%{date}
Release: %{release}
@peteryates
peteryates / gtlds.txt
Created October 24, 2013 07:53
All of the gTLDs listed on http://gtld.123-reg.co.uk/
.academy
.accountant
.accountants
.actor
.ads
.adult
.agency
.airforce
.alsace
.amsterdam