Skip to content

Instantly share code, notes, and snippets.

@leedo
leedo / gist:944770
Created April 27, 2011 17:44
redirect to a random image from rss feed list
use Plack::Builder;
use AnyEvent::Feed;
my $feeds = {};
my $img_re = qr{https?://[^\s]+\.(?:gif|png|jpe?g)}i;
sub add_feed {
my $url = shift;
$feeds->{$url} = {
images => [],
use Plack::Builder;
use AnyEvent::Feed;
use POSIX qw/ceil/;
my @image_urls;
my $img_re = qr{https?://[^\s]+\.(?:gif|png|jpe?g)}i;
my $feed = AnyEvent::Feed->new(
url => 'http://cutegirlsbeingcute.tumblr.com/rss',
interval => 60 * 60, # every hour
1 #!/usr/bin/perl
2 use AnyEvent::Feed;
3
4 my @image_urls;
5 my $img_re = qr{https?://[^\s]+\.(?:gif|png|jpe?g)}i;
6
7 my $feed = AnyEvent::Feed->new(
8 url => 'http://cutegirlsbeingcute.tumblr.com/rss',
9 interval => 60 * 60, # every hour
10 on_fetch => sub {
@leedo
leedo / gist:935616
Created April 21, 2011 22:28
dancer warning at launch
leedo@usealice:~/usealice$ perl -MCarp::Always app.psgi
Use of uninitialized value $_[0] in join or string at /home/leedo/perl5/lib/perl5/x86_64-linux-gnu-thread-multi/File/Spec/Unix.pm line 86
File::Spec::Unix::catdir('File::Spec', undef) called at /home/leedo/perl5/lib/perl5/x86_64-linux-gnu-thread-multi/File/Spec/Unix.pm line 100
File::Spec::Unix::catfile('File::Spec', undef) called at /home/leedo/perl5/lib/perl5/Dancer/FileUtils.pm line 33
Dancer::FileUtils::d_catfile(undef, 'views') called at /home/leedo/perl5/lib/perl5/Dancer/FileUtils.pm line 39
Dancer::FileUtils::path(undef, 'views') called at /home/leedo/perl5/lib/perl5/Dancer/Template/MicroTemplate.pm line 28
Dancer::Template::MicroTemplate::init('Dancer::Template::MicroTemplate=HASH(0x2451e58)', 'name', 'micro_template', 'config', 'HASH(0x2488030)', 'type', 'template') called at /home/leedo/perl5/lib/perl5/Dancer/Object.pm line 15
Dancer::Object::new('Dancer::Template::MicroTemplate', 'name', 'micro_template', 'type', 'template', 'config', '
package Alice::Role::HTTPD;
use AnyEvent;
use Any::Moose 'Role';
use Plack::Builder;
use Plack::Middleware::Static;
use Plack::Session::Store::File;
use Plack::Session::State::Cookie;
var move = function(e) {
var width = document.viewport.getWidth();
var left = windows.hasClassName('nicklist') ? 200 : 100;
var visible = toggle.hasClassName('visible');
if (!visible && width - e.pointerX() > left)
return;
window.onmousemove = null;
toggle.addClassName('visible');
require 'em/mysql'
require 'sequel/async'
require 'digest/sha1'
module Hector
# Identity adapters must implement the following public methods:
# - authenticate(username, password)
# - remember(username, password)
# - forget(username)
# - normalize(username)
my $pages = join "|", qw/chrome commands development faq features fluid guide
interest screenshots ssb status success thanks/;
get qr{^/(?<page>$pages)/?$} => sub {
my $captures = captures;
template $captures->{page};
};
this.messages.select('div.msg').each(function(msg){
msg.setStyle({borderWidth: "2px"});
msg.setStyle({borderWidth: "1px"});
});
--mimepart_4d77e7d9cb66b_2f87407d0b0275930
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: Quoted-printable
Content-Disposition: inline
<%=3D render(:file =3D> "user_mailer/password_changed.text.plain.haml.html"=
).to_plain_text %>