This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# An attempt to allow turnip steps something along the lines of; | |
# | |
# Then I should not see awesomeness! | |
# Then I shouldn't see awesomeness! | |
# Then I should see awesomeness! | |
step 'I :expectation see awesomeness!' do |expectation| | |
binding.pry ## | |
expectation | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
case v | |
when ->(v) { v == 1 } then puts 'one' | |
when &:even? then puts 'even' # Syntax error :( | |
when :odd?.to_proc then puts 'odd' | |
else puts v | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Options | |
# :primary_field The entity/model attribute for the first field, displayed by default. | |
# :secondary_field The entity/model attribute for the second field, hidden by default. | |
# :show_text The Show button label - defaults to 'Show'. | |
# :hide_text The Hide button label - defaults to 'Hide'. | |
# | |
# e.g. In our Spy form; | |
# f.input :name, as: :dual_field, | |
# primary_field: :alias, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def within_cell(row, column) | |
within_row(row) do | |
within_column(column) { yield } | |
end | |
end | |
def within_column(column) | |
# Find the table column offset for the column header, then grab the columns' cells at that offset. | |
# Adapted from http://stackoverflow.com/questions/14745478 | |
within(:xpath, "//table/tbody/tr/td[count(//table/thead/tr/th[normalize-space()='#{column}']/preceding-sibling::th)+1]") do |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
~/work/tmp/version_file <master +>± git status | |
# On branch master | |
# Changes to be committed: | |
# (use "git reset HEAD <file>..." to unstage) | |
# | |
# new file: foo | |
# | |
~/work/tmp/version_file <master +>± git diff --staged | |
diff --git a/foo b/foo | |
new file mode 100644 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
spoiler, .spoiler { | |
-webkit-transition: all 125ms linear; | |
-moz-transition: all 125ms linear; | |
-o-transition: all 125ms linear; | |
transition: all 125ms linear; | |
filter: blur(10px); | |
-webkit-filter:blur(10px); | |
-moz-filter: blur(10px); | |
-o-filter: blur(10px); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
DO | |
$$ | |
DECLARE | |
hidden_table record; | |
BEGIN | |
FOR hidden_table IN | |
SELECT schemaname, tablename FROM pg_tables | |
WHERE schemaname = (SELECT MAX(schemaname) FROM pg_tables WHERE schemaname LIKE 'snapshot_%') | |
LOOP | |
EXECUTE 'DROP TABLE IF EXISTS public.' || quote_ident(hidden_table.tablename) || ';'; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/ruby | |
colours = { :white => "\033[1;37m" \ | |
, :yellow => "\033[1;33m" \ | |
, :green => "\033[1;32m" \ | |
, :blue => "\033[1;34m" \ | |
, :cyan => "\033[1;36m" \ | |
, :red => "\033[1;31m" \ | |
, :magenta => "\033[1;35m" \ | |
, :black => "\033[1;30m" \ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ActiveAdmin::Register Package do | |
# A custom action we want treated like the :show or :edit actions. | |
member_action :overview, :method => :get do | |
@package = Package.find params[:id] | |
end | |
# Add the actions for the :overview action. | |
template_actions_for :overview, :show | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function prompt_char { | |
if [[ -d './.svn/' ]]; then echo '§' && return; fi | |
# it's faster to test for a `./.svn` directory than | |
# to exec `svn` & check return codes | |
git branch >/dev/null 2>&1 && echo '±' && return | |
hg root >/dev/null 2>&1 && echo '☿' && return | |
# redirect output of commands to /dev/null & | |
# echo custom char based on successful execution | |
echo '○' |