Skip to content

Instantly share code, notes, and snippets.

Avatar

Yves-Eric Martin yemartin

  • MediWeb, Inc.
  • Tokyo, Japan
View GitHub Profile
@yemartin
yemartin / README.md
Last active Dec 5, 2018 — forked from sj26/README.md
Run MailCatcher in the background, always, on OS X
View README.md

Run mailcatcher on startup, chruby version

Place me.mailcatcher.plist into ~/Library/LaunchAgents, then run launchctl load ~/Library/LaunchAgents/me.mailcatcher.plist. Adjust the ruby version according to your environment.

@yemartin
yemartin / public_protected_private.rb
Created Sep 7, 2018
Public, protected and private methods in Ruby
View public_protected_private.rb
# Note about `protected`:
#
# One use case for using `protected` is object comparator methods, where the method
# may need to call protected methods on `self` and another object of the same class.
# But 99% of the time, we don't write object comparator methods, that's why we almost
# Never use `protected`. See:
# See http://tenderlovemaking.com/2012/09/07/protected-methods-and-ruby-2-0.html
class MyClass
# Internal Visibility / Implicit Receiver
@yemartin
yemartin / quick_web_automation.rb
Created Nov 2, 2016
Quick and dirty use of Capybara against a live site, for automation or smoke tests.
View quick_web_automation.rb
#!/usr/bin/env ruby
OPEN_TIME = "07:45"
TARGET_SITE = "http://example.com/"
PATIENT_NUMBER = '1111111'
require 'time'
require 'capybara'
require 'selenium-webdriver'
View where_is_waldo.rb
require 'active_support/all'
@store = ActiveSupport::HashWithIndifferentAccess.new
def my_hash
@store[:foo] ||= {bar: 'BAR'}
end
my_hash[:waldo] = 'WALDO'
my_hash[:baz] = 'BAZ'
@yemartin
yemartin / pbhighlight
Created Jun 17, 2015
Highlight code snippet in the clipboard, making it ready to be pasted into keynote.
View pbhighlight
#!/bin/bash
#
# Dependency: highlight (http://www.andre-simon.de/doku/highlight/en/highlight.php)
# $ brew install highlight
#
# Usage:
# 1. Copy some code snippet into the clipboard.
# 2. $ pbhighlight [syntax] # syntax parameter is optional. Default set below.
# 3. Paste into Keynote.
#
View gist:560947bc4e85306f0c99
commit f6d3cbbb549fa1a2db898674e71bcf7890eee87c
Author: Yves-Eric Martin <yemartin@mediweb.jp>
Date: Thu Jul 10 16:20:25 2014 +0900
Add note about :new_records_only and UTC (Rails default) databases.
diff --git a/Documentation.textile b/Documentation.textile
index 15587b2..6d49bdd 100644
--- a/Documentation.textile
+++ b/Documentation.textile
You can’t perform that action at this time.