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
module AdminFormHelper | |
## | |
# All helpers related to form. | |
# | |
def build_form(fields = @item_fields) | |
returning(String.new) do |html| | |
html << "#{error_messages_for :item, :header_tag => "h3"}" | |
html << "<ul>" |
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 -e | |
### BEGIN INIT INFO | |
# Provides: starling | |
# Default-Start: 2 3 4 5 | |
# Default-Stop: 0 1 6 | |
# Short-Description: Start/stop starling server | |
### END INIT INFO | |
# | |
# starling This init.d script is used to start starling. | |
# It basically just calls starling. |
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
# http://gist.github.com/10524 | |
# Prevents autotest from running your entire test suite after fixing a failed test. | |
# Works with ZenTest 3.10.0 | |
# Place this in your .autotest file: | |
require 'rubygems' | |
require 'active_support' | |
class Autotest | |
def run_with_not_rerunning_everything | |
hook :initialize |
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
# RAILSLOVE.com template | |
# | |
# with help and ideas from: | |
# http://gist.github.com/33337 By Peter Cooper | |
# http://github.com/jeremymcanally/rails-templates/tree/master/suspenders.rb Suspenders by Thoughtbot Nathan Esquenazi | |
if yes?("symlink local rails copy to vendor?") | |
path = ask("what's the directory of your local rails copy?") | |
inside('vendor') { run "ln -s #{path} rails" } |
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
# Filters added to this controller apply to all controllers in the application. | |
# Likewise, all the methods added will be available for all controllers. | |
class ApplicationController < ActionController::Base | |
include Clearance::Authentication | |
helper :all # include all helpers, all the time | |
protect_from_forgery # See ActionController::RequestForgeryProtection for details | |
# Scrub sensitive parameters from your log | |
filter_parameter_logging :password |
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
class User < ActiveRecord::Base | |
include Roleify::RoleifyableModel | |
include Clearance::User | |
attr_accessible :username | |
validates_presence_of :username | |
validates_uniqueness_of :username | |
def self.authenticate(email, password) |
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
# Splits up alignemnt into block sized chunks and then render them as html | |
class RenderAlignment < CloudCrowd::Action | |
require 'rubygems' | |
require 'bio' | |
# Split up alignment | |
def split | |
fasta_sequences = Bio::FlatFile.open(input_path).to_a | |
alignment = Bio::Alignment.new(fasta_sequences) | |
block_size = options['block_size'] | |
number_of_blocks = (alignment.alignment_length/block_size.to_f).ceil |
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
# Author:: Anthony Underwood | |
# Date:: 2008-07-04 | |
require 'rubygems' | |
require 'bio' | |
# Method to perform a remote blast | |
# input:: a sequence object , a string specifiying the program (blastn, blastp, blastx etc), a remote database (e.g nr-nt for non-redundant) and options (e.g -e 0.0001) | |
# output:: a Bio::Blast::Report object | |
def remote_blast(seq_obj, program, db = 'nr-nt', options = '', server = 'genomenet') |
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
number_of_strains = 500 | |
k = 900 # number of variant sites in the alignment, i.e all non-consrved columns | |
harmonic_number = (1...number_of_strains).inject{|sum, n| sum + 1.0/n} # note ... so that this will calculate harmonic of n-1 | |
theta = k/harmonic_number |
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
[passenger@s0 ~]$ rvm --trace install 1.9.2 -C --with-openssl-dir=$HOME/.rvm/usr | |
+ [[ -z '' ]] | |
+ export 'PS4=+${BASH_SOURCE} : ${LINENO} : ${FUNCNAME[0]:+${FUNCNAME[0]}() : }' | |
+ PS4='+${BASH_SOURCE} : ${LINENO} : ${FUNCNAME[0]:+${FUNCNAME[0]}() : }' | |
+/home/passenger/.rvm/scripts/cli : 568 : __rvm_parse_args() : [[ -z '' ]] | |
+/home/passenger/.rvm/scripts/cli : 568 : __rvm_parse_args() : [[ -n '' ]] | |
+/home/passenger/.rvm/scripts/cli : 570 : __rvm_parse_args() : [[ 0 -eq 1 ]] | |
+/home/passenger/.rvm/scripts/cli : 570 : __rvm_parse_args() : [[ -n '' ]] | |
+/home/passenger/.rvm/scripts/cli : 14 : __rvm_parse_args() : [[ -n install ]] | |
+/home/passenger/.rvm/scripts/cli : 15 : __rvm_parse_args() : rvm_token=install |
OlderNewer