martes, 27 de diciembre de 2011

Git, the stupid content tracker, or not so


After roughly a year of using git daily, one has already crossed the "WTF!?" side and now is in the "It's obvious" land.

After getting help from all coworkers I had last year, lots (I mean *LOTS*) of reading, and many moments of "Am I the only one in the world that doesn't get this?", all regular processes go without thinking now, and I know pretty much what is happening under the hood.

Some things are still a bit raw on the edges, but mostly because they aren't used so often (submodules, bisect...), but I digress...

Thing is that using and knowing git gives you extra power, not directly related to versioning code. As Linus said: "git is the stupid content tracker", it manages blobs of bytes.

  • git grep: Probably faster than grep -ri, and more focused to what you surely want to search. I've already integrated it with emacs, and try to use it more and more, instead of rgrep, or ack.
  • git ls: great for the kind of find-file-in-project functionality.
  • git log -Sfoo : Search throughout the history
  • git log -p : modifications in context
  • git annex: manage whatever content
  • using git to deploy: There's capistrano, and puppet, and chef, and... but git can handle it if configured properly. Probably this can end in a mess if you need to trigger many things when deploying. You know, there are hooks and everything, and you cand build your poor-man-capistrano. It's just your choice. But definately for mostly static sites, it's a nice thing to keep in mind.
  • Not really a git feature, but thanks to magit, or fugitive, you can have a pretty painless integration with your workflow, so it's a win. And you feel safer

Have more tricks? Comment!

Ok, after a bit more than a month, there's a post precisely on that. Nothing new in the article, but there are nice insights in YC comments

domingo, 11 de diciembre de 2011

martes, 22 de noviembre de 2011

tramp + shell = win

Did you ever notice that tramp is a great piece of elisp? I hope so.

The nice thing I discovered today is that it's highly tighted to the whole system, and if you just m-x shell when you're in a file opened through tramp, it'll open a shell in the remote system.

Super nice.

domingo, 20 de noviembre de 2011

Creating a simple common lisp application

After giving a further look at common lisp (a bit of PAIP, and PCL), I've found a project that can be a nice 1st app for me.

To develop a common lisp app, first you need to set up the environment and choose the toolchain. These have been my decisions. Tips are pretty appreciated.

Requirements

The requirements are the bare minimum for common lisp. I use SBCL myself, and don't know much of the differences between implementations. sbcl works just fine.

Editor

I use emacs 24, with slime, paredit and autocomplete. Use whatever you feel like but notepad. Obviously, emacs is recommended :)

Libs

Use quickload to find and load libraries. It's surprisingly easy and straightforward to use.

Project

quickproject to initialize the project is a nice way to avoid writting bolierplate, and to make sure your project will be loadable through ,load-system.

Tests

I tried a couple of testing packages for common lisp, and decided to go with lisp-unit due to its simplicity and availability in ql repos.

Code repository

The code is being hosted in a private git repo in bitbucket. They give you unlimited public/private (*yes*, private) repos, using git/hg, with issue tracking and all, for free. It seems a nice nice alternative to github. great to host projects in early stage where you don't feel like sharing the code to the world.

That's it for now. There's no public code for the moment... There's nothing to see here :)

sábado, 12 de noviembre de 2011

change emacs url-browser

When you click an url in emacs, it'll open a browser with that url. That's fine.

Problems arise when you have multiple browsers and they fight to be your preferred one. In a coworker's box, it tries to open konqueror (WTF?!).

One way to fix the issue is changing browse-url-browser-function.


(setq browse-url-browser-function 'browse-url-generic
browse-url-generic-program "chromium-browser")


Not only that, but the nice thing would be that emacs reused a browser if you have one opened (firefox or chrome) and opened a new one (chrome) otherwise.

I've been messing a bit with proced.el to find out how to list external processes programmatically, but had no luck. If I find out how, I 'll modify this post with new info.

If you have related info, please, comment :)

Thanks to Davazp that pointed me to list-system-processes function, I just wrote the code to use an already opened browser to open a given url.



A good quickreference to look for function signature differences between elisp, scheme and cl is here. It helps quite a lot

domingo, 6 de noviembre de 2011

Metacircular game of life.W00t!

Here are a couple of links on game of life info.

First of all, a game of Life implemented in one line of APL, explained, so you can even try to understand it. Then, a couple of articles on cellular automatas, explaining game of life basics and not-so-basics.



And the really amazing stuff: Metacircular GoL