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 select_from_chosen(item_text, options) | |
field = find_field(options[:from]) | |
option_value = page.evaluate_script("$(\"##{field[:id]} option:contains('#{item_text}')\").val()") | |
page.execute_script("$('##{field[:id]}').val('#{option_value}')") | |
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
--colour | |
-I app |
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
source :rubygems | |
gem "sinatra", "~> 1.3.2" | |
group :test do | |
gem "minitest", "~> 2.10" | |
gem "rack-test", "~> 0.6.1" | |
gem "capybara", "~> 1.1" | |
gem "capybara-webkit", "~> 0.11" | |
gem "capybara_minitest_spec", "~> 0.2" |
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 | |
set -e | |
sudo apt-get install zbar-tools xdotool |
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
$stack, $draws = [], {} | |
def method_missing *args | |
return if args[0][/^to_/] | |
$stack << args.map { |a| a or $stack.pop } | |
$draws[$stack.pop(2)[0][0]] = args[1] if args[0] == :< | |
end | |
class Array | |
def +@ |
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
(defun toggle-maximize-buffer () "Maximize buffer" | |
(interactive) | |
(if (= 1 (length (window-list))) | |
(jump-to-register '_) | |
(progn | |
(set-register '_ (list (current-window-configuration))) | |
(delete-other-windows)))) | |
;; Bind it to a key. |
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
namespace :generate do | |
desc 'Generate a timestamped, empty Sequel migration.' | |
task :migration, :name do |_, args| | |
if args[:name].nil? | |
puts 'You must specify a migration name (e.g. rake generate:migration[create_events])!' | |
exit false | |
end | |
content = "Sequel.migration do\n up do\n \n end\n\n down do\n \n end\nend\n" | |
timestamp = Time.now.to_i |
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
1.9.2-p320 :001 > roses = "red" and "blue" | |
=> "blue" | |
1.9.2-p320 :002 > violets = "red" && "blue" | |
=> "blue" | |
1.9.2-p320 :003 > roses | |
=> "red" | |
1.9.2-p320 :004 > violets | |
=> "blue" |
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
# sysmouse will work with the trackpoint and trackpad, so enable | |
moused_enable="YES" | |
# Power saving features to keep it from getting ridiculously hot | |
powerd_enable="YES" | |
# you'll need to `pkg install drm-510-kmod` | |
kld_list="i915kms" |
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
defmodule ATGCCount do | |
def count(sequence), do: cnt(String.to_char_list(sequence),0,0) | |
def cnt([65|t],at,gc), do: cnt(t,at+1,gc) | |
def cnt([84|t],at,gc), do: cnt(t,at+1,gc) | |
def cnt([71|t],at,gc), do: cnt(t,at,gc+1) | |
def cnt([67|t],at,gc), do: cnt(t,at,gc+1) | |
def cnt([62|_],at,gc), do: {at,gc} | |
def cnt([],at,gc), do: {at,gc} | |
# def cnt(_,0,0), do: {0,0} | |
def cnt([_|t], at, gc), do: cnt(t,at,gc) |
OlderNewer