Skip to content

Instantly share code, notes, and snippets.

View j1n3l0's full-sized avatar

Nelo Onyiah j1n3l0

  • Goznel Limited
  • Kent UK
  • 08:28 (UTC -12:00)
View GitHub Profile
# steps required to run pfind and save the output
# 2010-07-10
#
pfind $PROJECT
cd $PROJECT_DIR
update_caf
cat ./CAF/caf.raw | caf2clipped_fasta -fasta $PROJECT.fa
# project euler problem 001 in rakudo
[+](1..^1000).grep({ $_ % any(3, 5) == 0 })
@j1n3l0
j1n3l0 / gist:536625
Created August 19, 2010 00:15
does the call context affect the return value [perl6,sub,signature,context]
# what should happen when i assign the result of this function to:
# - an array
# - a hash
multi function ( Str $string, Int $times ) returns Array { gather for 1 .. $times { take $string } }
my @test = function( 'hi', 4 );
my %test = function( 'hi', 4 );
@j1n3l0
j1n3l0 / load_from_file.rb
Created August 25, 2010 15:33
HowTo: load a YAML data structure from a file (succinctly) [ruby, yaml]
#!/usr/bin/env ruby
require 'rubygems'
require 'yaml'
require 'pp'
pp YAML.load_file( 'data.yml' )['development']
@j1n3l0
j1n3l0 / allele_symbol_superscript.pl
Created August 26, 2010 15:12
modify the value of a 'ro' attribute with an 'around' method modifier [perl, moose]
#!/usr/bin/env perl
use 5.012;
use Test::Most;
{
package Foo;
use Moose;
has bar =>
( is => 'ro', isa => 'Str', required => 1 );
around bar => sub {
@j1n3l0
j1n3l0 / load_specific_gem_version.rb
Created September 1, 2010 13:14
Howto: load a specific version of the allele_image gem (as this affects the coverage tests) [ruby,version,rake,gem]
require 'rubygems'
require 'rake'
desc 'load specific version of allele_image'
task :load_version, [ :file, :version ] do |task, args|
args.with_defaults( :version => '0.1.1' )
raise 'Please provide input file' unless args[:file]
gem 'allele_image', "= #{ args[:version] }"
require 'allele_image'
AlleleImage::Image.new( args[:file] ).render.write( args[:file].gsub( /\.\w+$/, '.png' ) )
@j1n3l0
j1n3l0 / make_escells_rest_red.js
Created September 15, 2010 10:34
A few jQuery snippets [jquery, javascript]
// make the escells.rest rows red navigating from the toggle
jQuery("a.escells_toggle").each( function () {
var escells = jQuery(this).parent().children("table").children("tbody.escells").children();
// give it a background color
escells.slice(2, escells.size()).css("background-color", "red");
});
@j1n3l0
j1n3l0 / checkout_a_new_project.sh
Created September 16, 2010 23:10
some notes on git-svn [git, svn]
git svn clone -s $URL_TO_SVN_REPO repo_name
cd repo_name
git reset --hard remotes/trunk
@j1n3l0
j1n3l0 / tryme.rb
Created September 20, 2010 10:31
An example of how to use the genbank generating code from ruby [perl,ruby,genbank,work]
#!/usr/bin/env ruby
# An example of how to use the genbank generating code from ruby
genbank = %x[perl -mHTGT::Utils::GenerateGenBankString=:all -e 'print generate_genbank_string(@ARGV)' #{ ARGV.join(' ') }]
puts genbank
@j1n3l0
j1n3l0 / tryme.rb
Created September 21, 2010 13:37
HowTo: Use getoptlong in ruby [ruby,getopt]
require 'rubygems'
require 'getoptlong'
require 'pp'
@database = ENV["HTGT_ENV"] == 'Devel' ? 'development' : 'production'
@debug = false
@config_file = '/path/to/config.yml'
opts = GetoptLong.new(
[ '--pipeline', '-p', GetoptLong::REQUIRED_ARGUMENT ],