Skip to content

Instantly share code, notes, and snippets.

require 'open-uri'
require 'rubygems'
require 'hpricot'
ARGV.each do |gi|
# Fetch the URL and pass the contents to Hpricot
url = "http://www.ncbi.nlm.nih.gov/entrez/eutils/efetch.fcgi?db=protein&id=#{gi}&rettype=fasta&retmode=xml"
doc = Hpricot.XML(open(url).read)
use Cache::Memcached;
use IO::Socket::INET;
my $testaddr = "127.0.0.1:22122";
my $msock = IO::Socket::INET->new(PeerAddr => $testaddr,
Timeout => 3);
my $memd = Cache::Memcached->new({
servers => [ $testaddr ]
});
GiftMessage = $.klass({
initialize: function(options) {
this.hoverClass = 'HoverItem';
},
onmouseover: function() {
this.element.addClass(this.hoverClass);
},
onmouseout: function() {
def helloworld(self):
print "Hello World"
helloworld()
@dieseltravis
dieseltravis / gist:2519
Created July 25, 2008 20:43
adding a drop shadow to the page using RUZEE.ShadedBorder
/* add shadow to page */
$("#body").wrap("<div id=\"body-shadow\" style=\"width:800px; margin: auto; padding: 0 4px 5px 0;\"></div>");
var border = RUZEE.ShadedBorder.create(
{
corner: 1,
shadow: 8,
border: 0,
borderOpacity: 0.8
}
);
#!/bin/sh
export COLUMNS=$COLUMNS # term width isn't exported properly :(
export PS1='`ps1`'
@anotherjesse
anotherjesse / gist:2522
Created July 25, 2008 21:04
add a santize :column_name to sanitize to html
include ActionView::Helpers::TagHelper, ActionView::Helpers::TextHelper, WhiteListHelper
module ActiveRecord
class Base
def self.sanitize(attr_name, options = {})
define_method "#{attr_name}=" do |val|
write_attribute attr_name, val
html = ''
####<Jul 25, 2008 5:04:19 PM EDT> <Error> <HTTP> <nclwebdevapp02> <NCLWEBDEVAPP02> <ExecuteThread: '12' for queue: 'weblogic.kernel.Default'> <<WLS Kernel>> <> <BEA-101019> <[ServletContext(id=67489679,name=myncl,context-path=/myncl)] Servlet failed with IOException
java.io.FileNotFoundException: /home/weblogic/bea/user_projects/domains/NCLWEBDEVdom/./NCLWEBDEVAPP02/.wlnotdelete/extract/NCLWEBDEVAPP02_myncl_myncl/jsp_servlet/_common/_layout/__home_template.java (No such file or directory)
at java.io.FileOutputStream.open(Native Method)
at java.io.FileOutputStream.<init>(FileOutputStream.java:179)
at java.io.FileOutputStream.<init>(FileOutputStream.java:131)
at java.io.FileWriter.<init>(FileWriter.java:73)
at weblogic.servlet.jsp.Jsp2Java.makeOutputStream(Jsp2Java.java:301)
at weblogic.utils.compiler.CodeGenerator.generateCode(CodeGenerator.java:337)
at weblogic.utils.compiler.CodeGenerator.generate(CodeGenerator.java:286)
at weblogic.servlet.jsp.JspStub.compilePage(JspStub.java:388)
parse_git_branch() {
git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/(\1)/'
}
PS1='\[\e[31;1m\]\u@\h:\w$(parse_git_branch)$ \[\e[0m\]'
'class' branch: (refactoring to make Flac2mp3 a class, use instance behavior, &c)
53 bin/flac2mp3
151 lib/flac2mp3.rb
94 spec/flac2mp3_command_spec.rb
746 spec/flac2mp3_spec.rb
Total score = 145.244414937566
Flac2mp3#convert_tags: (32.3)
20.9: assignment