Skip to content

Instantly share code, notes, and snippets.

View SebDeclercq's full-sized avatar

Sébastien Declercq SebDeclercq

View GitHub Profile
@SebDeclercq
SebDeclercq / gist:2585720
Created May 3, 2012 13:40
Error while running populate-db.pl
################ schema.sql ####################
# CREATE TABLE Law (
# id integer primary key,
# title text not null,
# lastdate date not null,
# auth text
# );
# CREATE TABLE LawVersion (
# lawid integer references Law(id),
# numid text primary key not null,
-- CREATE STANDARD TABLES FOR LawDB.db
CREATE TABLE Law (
id integer primary key autoincrement,
content text not null,
lastdate date not null,
presc text
);
CREATE TABLE LawVersion (
lawid integer references Law(id),
#! /usr/bin/perl -w
use strict;
use warnings;
package My::LawDB::Schema;
use base qw(DBIx::Class::Schema::Loader);
package main;
use Dancer ':syntax';
use Dancer::Plugin::DBIC;
use Template;
#! /usr/bin/perl -w
use strict;
use warnings;
package main;
use Dancer ':syntax';
use Dancer::Plugin::DBIC;
use Template;
package My::LawDB::Schema;
use base qw(DBIx::Class::Schema::Loader);
@SebDeclercq
SebDeclercq / gist:2875643
Created June 5, 2012 15:22
Code moche mais fonctionnel
any [ 'get', 'post' ] => '/law/:numid' => sub {
my $numid = params->{numid};
my ($lawid);
my $rs = schema->resultset('Law')->search();
while (my $law = $rs->next) {
my @lawvs = $law->law_versions;
for (@lawvs) {
if ($_->numid() eq $numid ) {
my @lawids = $_->lawid();
#! /usr/bin/perl -w
use strict;
use warnings;
use feature 'say';
use Data::Dump;
my %total_bytes;
while (<>) {
my ($source,$destination,$bytes) = split;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Check new incomes in Gmail INBOX (using Elisp only) ;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(defun gmail-check ()
(interactive)
;; Download Gmail INBOX feed (requires identification in minibuffer)
(url-copy-file "https://mail.google.com/mail/feed/atom" "/tmp/gmail.atom")
;; Still can't use with-temp-buffer properly, so open file in new buffer
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Adding shortcuts for text formatting ;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(defun org-set-bold ()
"Mark current region as bold or open new bold mark ups"
(interactive)
(let (rstart rend)
(if (region-active-p)
#! /usr/bin/perl -w
use strict;
use warnings;
use feature 'say';
use LWP::Simple;
my @page = get('http://www.rtbf.be/classic21/conducteur');
my ( $song, $singer );
(defun classic21-currently-playing ()
(interactive)
(url-copy-file "http://www.rtbf.be/classic21/conducteur" "/tmp/classic21.html")
(find-file "/tmp/classic21.html")
(goto-char 1)
(setq song-start (search-forward "<h4>Titre: <strong>")
song-end (- (search-forward "</") 2)
singer-start (search-forward "<p>Artiste: <strong>")
singer-end (- (search-forward "</") 2))