A quick post, despite being all busy and stuff, that answers a few questions for the Greater Good.
Continue reading
I do robots Beamer theme
Recently I’ve been looking for a simple and readable Beamer theme but all of the ones I found lacked something in one way or another. Finally, I settled for a theme of my own – based on Amsterdam theme by Rogier Koppejan adding frame numbering to the footer. It’s simple, it’s sleek. It’s all I want.
Here you can find a few sample slides using the theme and here you’ll find the theme itself.
It consists of a header containing outline of the presentation and a footer containing navigation box and all the necessary info such as authors name and institute, presentation title and a frame counter.
Templated Monads? Monadic Templates?
So, I finally found some time for a Template Metaranting follow-up post. This time let’s get down to business as this one contains a fair amount of code.
Sadly, I won’t rant as much but instead I’ll try to show how awesome D‘s templates really are. We’ll write a piece of code, based on this Scheme implementation, that is, a simple monad that we’ll use to build a binary tree, with uniquely numbered nodes containing their height, without any global state (therefore purely) entirely at compile time.
Template Metaranting
Here’s another post in the series, this time it’s C++ vs. the D programming language.
Let’s talk about templates.
If you’ve ever tried templates in C++ you surely as hell recall the pages and PAGES of compiler errors and seemingly random placement of typename keyword.
Trust me, there are EVEN WORSE problems with templates in C++… Consider the following:
1: struct Foo { 2: template<int N> 3: void bar() {} 4: 5: template<int N> 6: struct Bar {}; 7: }; 8: 9: template<typename T> 10: void f() { 11: T foo; 12: foo.template bar<0>(); 13: typename T::template Bar<0> b; 14: } 15: 16: int main() { 17: f<Foo>(); 18: } 19:
Romans, rubies and the D
There’s an increasing interest with the D programming language amongst my readers so I figured I’ll post a bunch of short posts about D and see what happens.
Anyway, here’s a classic example showing Ruby’s capabilities taken from Seven Languages in Seven Weeks:
class Roman def self.method_missing name, *args roman = name.to_s roman.gsub!("IV", "IIII") roman.gsub!("IX", "VIIII") roman.gsub!("XL", "XXXX") roman.gsub!("XC", "LXXXX") (roman.count("I") + roman.count("V") * 5 + roman.count("X") * 10 + roman.count("L") * 50 + roman.count("C") * 100) end end puts Roman.X puts Roman.XC puts Roman.XII
Instant docs in StumpWM
Here’s a cool hack I use to optimize my docs searching.
Let’s start off with DuckDuckGo search engine.
By itself it’s a pretty powerful tool thanks to its numerous features like the !bang syntax. For example searching for:
!cpp std::string::clear
…takes me exactly where I want.
Let’s use it to our advantage, shall we?
StumpWM is a tailing window manager that allows you to define system-wide key bindings that work and feel pretty much like Emacs ones. Combining that with DuckDuckGo’es !bang syntax makes you just a few clicks away from anything out there:
(defcommand duckduckgo (phrase) ((:string "Search: ")) "Searches for something on DuckDuckGo." (run-shell-command (concatenate 'string *your-fav-webbrowser* " http://duckduckgo.com/?q=" (substitute #\+ #\Space phrase)))) (define-key *root-map* (kbd "d") "duckduckgo")
Now, if you want to find out if I used substitute correctly all you have to do is:
C-t d !lisp substitute
…what will take you directly there. Turns out I did.
But wait, there’s more!
Continue reading
LRRH
Here’s a little something I was actively developing arround this time last year and recently ported to Linux.
It’s a little game me and a couple of guys made while in SKN Shader.
Here’s a video, make sure to watch it in HD!
The video isn’t mine because my desktop-recording-fu isn’t THAT good, so I failed miserably fighting with *cough* the audio *cough*.
Continue reading
