I hereby claim:
- I am aaroncrobinson on github.
- I am aaroncrobinson (https://keybase.io/aaroncrobinson) on keybase.
- I have a public key ASCGmnIqwwx1AkTAQzb1y50-qB7jvsrYOXR7aqfYTeCURAo
To claim this, I am signing this object:
| // Reference: http://stackoverflow.com/questions/4822471/count-number-of-lines-in-a-git-repository | |
| $ git ls-files | xargs wc -l |
I hereby claim:
To claim this, I am signing this object:
| module Test | |
| @@options = nil | |
| end | |
| module TestIncludedA | |
| include Test | |
| def set_options | |
| @@options = "something" | |
| end |
| # http://whytheluckystiff.net/articles/seeingMetaclassesClearly.html | |
| # NOTE: originally used above meta_def method but extended for arguements | |
| class Object | |
| def meta_def name, method | |
| # add class variable method with arguement passthrough | |
| (class << self; self; end).instance_eval { define_method(name) { |*args| method.call(*args)} } | |
| end | |
| end | |
| require 'date' |
| class String | |
| def classify | |
| self.split('_').collect!{ |w| w.capitalize }.join | |
| end | |
| end |
| #!/usr/bin/ruby | |
| # Example of using a module with a class for mixin-ish behavior | |
| module ModA | |
| class ClassB | |
| attr_accessor :var | |
| def initialize | |
| puts "Initializing ClassB" | |
| @var = nil | |
| end |
| import argparse, regex, csv | |
| from Bio import SeqIO | |
| def countHomopolymers(seq): | |
| """ Given a string sequence, return a dictionary counting its homopolymers """ | |
| # split the string into homopolymers | |
| # NOTE: regex will produce empty strings, filter them | |
| segments = filter(None, regex.findall('[A]*|[T]*|[C]*|[G]*',seq.upper())) | |
| mersDict = {'A':[0]*7,'T':[0]*7,'C':[0]*7,'G':[0]*7} | |
| for seq in segments: |
| #!/usr/bin/ruby2.0 | |
| # NOTE: only works with Ruby 2.0 | |
| # CONTEXT: One of my favorite features to python is decorators. | |
| # This is the most elegant and clean solution for | |
| # decorator-like functionality in Ruby. | |
| # RELATED: originally posted as anon - https://gist.github.com/anonymous/9103635 | |
| class A | |
| def initialize(msg=nil) | |
| @msg = msg |