Skip to content

Instantly share code, notes, and snippets.

View scrap.rb
require 'hpricot'
require 'open-uri'
require 'date'
class Post
attr_accessor :author, :title, :date, :tags, :comments
def initialize url
doc = Hpricot(open(url))
@author ="//author/name").fetch(1).inner_text
View Perl Arrays as Instance Variables
sub new {
my ($class) = @_;
my @owned_files = ();
#The 'shared' files are the files that a user can read but does not own
my @shared_files = ();
my $self = {
#$[0] is the class
_name => $_[1],
import curses
from curses.ascii import isdigit
import nltk
from nltk.corpus import cmudict
d = cmudict.dict()
def nsyl(word):
return [len(list(y for y in x if isdigit(y[-1]))) for x in d[word.lower()]]
ChimeraCoder / .screenrc
Created June 18, 2011 14:21
View .screenrc
escape \000\040
bind n focus down
bind ^n focus down
bind p focus up
bind ^p focus up
bind k next
bind ^k next
bind j prev
bind ^j prev
ChimeraCoder / .gitconfig
Created June 18, 2011 19:40
Git config file
View .gitconfig
diff = auto
status = auto
branch = auto
interactive = auto
ui = true
pager = true
[color "branch"]
current = yellow reverse
ChimeraCoder /
Created February 1, 2012 03:58
HJava: Imagining a (more) homoiconic Java
//HJava (HomoiconicJava): Imagining a (more) homoiconic Java
//In Java, the unit is the *class*
//So in HJava we will pretend that everything is a class (or, at least, an instance of a class).
//Obviously this won't compile in Java, because Java doesn't actually support homoiconic structures.
//But HJava does!
public class HomoiconicJava {
ChimeraCoder / gist:3152820
Created July 20, 2012 19:45
npm (node.js) equivalent of Python's pip freeze?
View gist:3152820
#Please tell me there is a better way to do this
#(And by 'a better way', I don't mean incorporating the cut within the awk script)
npm ls | grep -E "^(├|└)─" | cut -d" " -f2 | awk '{FS = "@"; print "\""$1"\"", ":", "\""$2"\""}'
ChimeraCoder / gist:3156673
Created July 21, 2012 18:28
jitsu deploy errors
View gist:3156673
bash-4.2$ jitsu deploy
info: Welcome to Nodejitsu chimeracoder
info: It worked if it ends with Nodejitsu ok
info: Executing command deploy
info: Analyzing your application dependencies in app.js
warn: Local version appears to be old
warn: Your package.json version will be incremented for you automatically
warn: About to write /Users/aditya/programming/nodejs/wasp/package.json
data: {
ChimeraCoder / gist:3404362
Created August 20, 2012 14:01
World's first WWW server
View gist:3404362
ChimeraCoder / gist:3645946
Created September 5, 2012 22:07
Sample Racket Docstring Pseudocode
View gist:3645946
;;Basic format; will create definition normally and ignore docstring entirely
(define-syntax autodoc (syntax-rules (define) [(_ docstr (define (name arg ...) body ...)) (define (name arg ...) body ...)])
;;Simple expanded example; will create definition and also print docstring each time function is called
(define-syntax autodoc2 (syntax-rules (define) [(_ docstr (define (name arg ...) body ...)) (define (name arg ...) (begin (print docstr) body ...))]))
;; Function definition
(autodoc "Function that increments numbers"
(define (my-incr x)