Skip to content

Instantly share code, notes, and snippets.

Zbigniew Łukasiak zby

Block or report user

Report or block zby

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@zby
zby / session-test
Created Jan 20, 2013
The referer changes correctly, but the session is first {} and then always: {:x nil}
View session-test
(ns login-app.ex)
(use 'ring.middleware.session
'ring.util.response)
(defn handl [{session :session uri :uri headers :headers}]
(let [body
(str
"<html><body>"
session "<br>\n"
View gist:4564733
$ cat src/login_app/core.clj
(ns login-app.core)
(defn handler [request]
{:status 200
:headers {"Content-Type" "text/html"}
:body "Hello World"})
[ snip ]
View gist:4509425
sub frobnicate {
my( $self, $data ) = @_;
...
$self->twiddle( $data );
...
}
sub twiddle {
my( $self, $data ) = @_;
...
View gist:4509300
while ( my $data = $self->next ) {
my $featues = Text::FeatureCount->new->analyze($data->{content});
View gist:3986332
sub frobnicate {
#...
my $dbh = MyApp->dbh;
#...
}
# or
sub frobnicate {
#...
@zby
zby / quine.pl
Created Oct 6, 2012
a simple perl quine
View quine.pl
my $x = 'my $x = X;
$y = chr(39) . $x . chr(39);
$x =~ s/X/$y/;
print $x;
';
$y = chr(39) . $x . chr(39);
$x =~ s/X/$y/;
print $x;
@zby
zby / gist:2623798
Created May 6, 2012
new api writer
View gist:2623798
Dim f As New FileObject
f.Open(OpenMode.Write, "TextFile.txt")
f.WriteLine("A line of text")
f.Close()
View gist:2623785
Dim sv As StreamWriter = New StreamWriter("TextFile.txt")
sw.WriteLine("A line of text")
sw.Close()
@zby
zby / gist:2623391
Created May 6, 2012
writing to a file
View gist:2623391
Import System
Import System.IO
Class Test
Public Shared Sub Main()
Try
' Create an instance of StreamReader to read from a file.
Dim sr As StreamReader = New StreamReader("TestFile.txt")
Dim line As String
' Read and display the lines from the file until the end
@zby
zby / gist:2508353
Created Apr 27, 2012
pure but using objects
View gist:2508353
sub markdown {
my( $text, $title ) = @_;
my $parser = Markdent::Simple::Document->new();
return $parser->markdown_to_html(
title => 'My Document',
markdown => $markdown,
);
}
You can’t perform that action at this time.