Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

signature tag used

  • Loading branch information...
commit d3008173bdf654922799e9c113ae6b3c8bdb4ac6 1 parent d28f7f6
Paulo Suzart authored
22 plugins/signature.rb
View
@@ -0,0 +1,22 @@
+# A Liquid tag for signatures
+# by: Paulo Suzart
+# Source https://gist.github.com/2372727
+#
+# Example usage: {% signature paulosuzart %}
+module Jekyll
+
+ class SignatureTag < Liquid::Tag
+ def initialize(tag_name, text, token)
+ super
+ @text = text.strip!
+ end
+
+ def render(context)
+ <<-HTML
+<p>Don't forget to visit the <a href="/about">about</a> page. And follow me on Twitter: <a href="http://twitter.com/#{@text}">@#{@text}</a>.</p>
+ HTML
+ end
+ end
+end
+
+Liquid::Template.register_tag('signature', Jekyll::SignatureTag)
4 source/_posts/2011-10-30-dateparammatcher-for-finagle.markdown
View
@@ -52,4 +52,6 @@ Note that if the param named `requestTimeParam` is not present or carries a inva
Although easy to build and extract params from query string and requested path, it is not a Finagle strength. It is kinda limited. A better abstraction is offered by [Unfiltered](https://github.com/unfiltered/unfiltered)(another [@n8han's](http://twitter.com/n8han) great job).
-Hope you enjoy it.
+Hope you enjoy it.
+
+{% signature paulosuzart %}
2  source/_posts/2011-10-30-what-you-are-supposed-to-find-here.markdown
View
@@ -10,4 +10,4 @@ Hi, this is another blog of mine. Yap, I have a - mostly in portuguese - wordpre
The main reason to starting blogging directly on my Github is to keep the subjects even more focused on projects committed here, and share some experiences with some libs also committed here.
-Hope you enjoy the content. Please don't forget to visit the [about](/about) page. And follow me at Twitter: [@paulosuzart](http://twitter.com/paulosuzart)
+{% signature paulosuzart %}
2  source/_posts/2011-12-04-korma-and-clojure-records.markdown
View
@@ -70,4 +70,4 @@ Now your code is a bit more resilient to database changes with this thing layer
Korma can do a lot of things to make your life easier, as the abililty to compose queries, and performs really nice. Think I finally found THE framework for relational data access in clojure.
-Don't forget to visit the [about](/about) page. And follow me on Twitter: [@paulosuzart](http://twitter.com/paulosuzart)
+{% signature paulosuzart %}
2  source/_posts/2011-12-11-my-own-redis-types-notation.markdown
View
@@ -44,4 +44,4 @@ It is simple and is helping a lot. Another good thing I started to do is to writ
I'm using [clj-redis](https://github.com/mmcgrana/clj-redis/) interact with redis.
-Hope it may be useful for you. Don't forget to visit the [about](/about) page. And follow me on Twitter: [@paulosuzart](http://twitter.com/paulosuzart)
+{% signature paulosuzart %}
2  source/_posts/2011-12-11-my-own-redis-types-text-notation.markdown
View
@@ -35,4 +35,4 @@ An instance of this process would be:
It is the form I'm using as doc strings in a namespace. It looks great with [Marginalia](http://www.fogus.me/fun/marginalia/).
-Hope it may be useful for you. Don't forget to visit the [about](/about) page. And follow me on Twitter: [@paulosuzart](http://twitter.com/paulosuzart)
+{% signature paulosuzart %}
4 source/_posts/2012-02-03-clojure-macros-automating-aws-simpledb-admin-tasks.markdown
View
@@ -76,4 +76,6 @@ If take a closer look you may notice a function call to `(env "AWS_KEYID")`. It
You can extend the macro to have any admin task you may need. Note that the `*sdbconf*` will become available, so you can call rummage directly without having to configure all again.
-That is it. Clojure is smart!
+That is it. Clojure is smart!
+
+{% signature paulosuzart %}
2  source/_posts/2012-03-25-web-noir-plus-enlive-template.markdown
View
@@ -101,4 +101,4 @@ lein run
And start having fun with enlive and noir. This project template may be evolved to have [korma](http://sqlkorma.com/) or any persistence framework.
-Hope it may be useful for you. Don't forget to visit the [about](/about) page. And follow me on Twitter: [@paulosuzart](http://twitter.com/paulosuzart)
+{% signature paulosuzart %}
4 source/_posts/2012-03-27-lazy-seqs-from-database-with-clojure-korma.markdown
View
@@ -43,7 +43,9 @@ Just to play around, try:
It returns from 0 to 10, being a finite lazy sequence just like the source data set. One can use `take-while` to limit the results of a lazy-seq. You can compute really big sets using the laziness approach.
-Hope it may be useful. Don't forget to visit the [about](/about) page. And follow me on Twitter: [@paulosuzart](http://twitter.com/paulosuzart).
+Hope it may be useful.
+
+{% signature paulosuzart %}
**Update - Apr 7 2012**: *Although an interesting and working solution, this code is not that functional. First of all, because it does I/O, but there is something that could be fixed to have a better "purity". `map` or `pmap` produce new sequences. Sequences full of `nils` in this case, because `persist` returns `nil`. The only advantage is the use of `pmap`, to run it in parallel, but it is still weird to have resulting seqs of `nils`.*
35 source/_posts/2012-04-11-sorting-with-clojure-comparator.markdown
View
@@ -0,0 +1,35 @@
+---
+layout: post
+title: "sorting with clojure comparator"
+date: 2012-04-11 22:51
+comments: true
+categories: clojure elementary
+---
+
+This is a quick post to show an example of [clojure](http://clojure.org) `comparator` for sorting a list with `sort`.
+
+At work a friend wrote dozen lines of java to sort a list of characters that represents t-shirt sizes. The sizes are: pp, p, m, mm, g, gg, a, aa. Whre pp is super small, p small, m medium, etc.
+
+Some shees have all the sizes available, some not. So imagine a shirt with just g, a, gg, p sizes availabe. The screen should show: p, g, gg, a.
+
+He requested me to do a clojure version of it. Here it goes.
+
+{% gist 2351780 %}
+
+The first useful function is [`map-indexed`](http://clojuredocs.org/clojure_core/clojure.core/map-indexed). Since the order of sizes is not natural, we associate numbers to them given we know the size order. So `sizes` becomes `{:a 6, :gg 5, :g 4, :pp 0, :m 2, :mm 3, :aa 7, :p 1}`.
+
+Then I used a [`comparator`](http://clojuredocs.org/clojure_core/clojure.core/comparator). It produces a `java.util.Comparator` for the given function. In this case the comparison of the map values for each key.
+
+To finish that, the [`sort`](http://clojuredocs.org/clojure_core/clojure.core/sort) function. It takes a given product sizes list and sorts then. So `'(p, g, gg, aa)` becomes `(p g gg a)`.
+
+It is even silly for a blog post but what if I can convince him to replace the java methods/utils/whatever methods for a [`gen-class`](http://clojuredocs.org/clojure_core/clojure.core/gen-class) of it? Packing compiled clojure code and using them for utility functions and small piece of your application can be a good way to get used to the language and confidence to start a full application in it.
+
+Actually to let this code resuable, one can take the list of sizes instead of hard coding it. But this is an exercise for you.
+
+{% signature paulosuzart %}
+
+*Thanks to USA guys, you are the top visitors here. Thank you very much.*
+
+
+
+
Please sign in to comment.
Something went wrong with that request. Please try again.