Skip to content

Instantly share code, notes, and snippets.

<?
function replace_h($matches) {
print_r($matches); die;
return $matches[1] . "\n" . str_repeat('-', length($matches[1]));
}
function replace_a($matches) {
return $matches[2] . " (" . $matches[1] . ") ";
}
sub head_data {
my $self = shift;
my $data = $self->next::method();
$data->{date_of_last_entry}
= sprintf('%d-%02d-%02dT%02d:%02d:%02d',
@{$self->{entries}[-1]}{qw(yr mo_num da hr min)}, 0);
return $data;
}
@Altreus
Altreus / anag.pl
Created October 21, 2010 16:07
anag.pl word /path/to/dict - find (simple) anagrams
open$h,pop;$s=[sort pop=~/./g];$s~~[sort/./g]&&print for<$h>
@Altreus
Altreus / gist:723399
Created December 1, 2010 12:06
Doing a form, very basic
We couldn’t find that file to show.
#!/usr/bin/perl
use strict;
use warnings;
use Opt::Imistic;
use Data::Dumper;
print Dumper (\%Opt::Imistic::opts);
$.fn.promulgate = function() {
// this != the function!!
this.data = ':<'; # no
}
jQuery is all like $.fn.promulgate.apply(something else)
my $sc = Scraper->new($url);
while (my $manu = $sc->next_manufacturer()){
while (my $cat = $manu->next_category()) {
while (my $prod = $cat->next_product()) {
# woot
}
}
}
$ tar tzf Dropbox/Public/mc-client-buildcraft\[additional\]-forestry-wireless-ic2-redpower-enderchests.tar.gz
.minecraft/
.minecraft/bin/
.minecraft/bin/minecraft.jar
.minecraft/buildcraft/
.minecraft/buildcraft/blueprints/
.minecraft/buildcraft/blueprints/direwolf20.list
.minecraft/buildcraft/blueprints/rycudas.list
.minecraft/buildcraft/blueprints/index.txt
.minecraft/buildcraft/blueprints/Altreus.list
master o-o-o-o-o-A
A - original master
set statusline=all\ the\ stuff\ %{FindSub()}\ and\ more\ stuff
function! FindSub()
let subpattern = '\(sub\|function\) \w\+'
let subline = search(subpattern, 'bnW')
if !subline
return 'not in sub'
else
return matchstr(getline(subline), subpattern)
endif