This file contains 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 hexlify(msg) | |
msg.split("").collect { |c| c[0].to_s(16) }.join | |
end | |
def unhexlify(msg) | |
msg.scan(/../).collect { |c| c.to_i(16).chr }.join | |
end | |
puts hexlify("Hello World") |
This file contains 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
#!/bin/sh | |
BRANCHES=`git branch` | |
if [ $? != 0 ]; then | |
exit | |
fi | |
GIT_SVN=0 | |
git branch -r | grep 'git-svn' > /dev/null | |
if [ $? = 0 ]; then | |
GIT_SVN=1 |
This file contains 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
puts "\n--- watchr initialized ---\n\n" | |
def cmd() 'script/spec '; end | |
def run_all_specs | |
system(cmd + 'spec/') | |
end | |
def run_spec(spec) | |
puts "Running #{spec}" |
This file contains 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
Then /^I should see element "([^"]*)" before element "([^"]*)"$/ do |first, second| | |
xpath = "//*[@id='#{first}']/following-sibling::*[@id='#{second}']" | |
response_body.should have_xpath(xpath) | |
end |
This file contains 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
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="utf-8"> | |
<meta name="viewport" content="width=device-width"> | |
<title>JS Bin</title> | |
<script src="https://code.jquery.com/jquery-3.0.0.js"></script> | |
</head> | |
<body> | |
<h1>My Awesome ToDo List</h1> |
This file contains 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
# app/models/image.rb | |
class Image < ActiveRecord::Base | |
has_many :taggings, :as => :taggable | |
has_many :tags, :through => :taggings | |
end |