This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
################ 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, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- 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), |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /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; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /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); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /usr/bin/perl -w | |
use strict; | |
use warnings; | |
use feature 'say'; | |
use Data::Dump; | |
my %total_bytes; | |
while (<>) { | |
my ($source,$destination,$bytes) = split; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
;; 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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
;; 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) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /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 ); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(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)) |
OlderNewer