I’m back with some Code …

Posted: July 6th, 2009 | Author: FreedomCoder | Filed under: Open Source, Programming, github, how-to | Tags: , , , | No Comments »

Well, hello again, long time since the last post. I went on vacations, work a lot and did some programming. Let’s talk abount the programming part, since it is the most interesting one. ;)

I created a small library called “Esearchy” capable of searching the internet for email addresses. Currently, we the supported search methods are engines such as Google, Bing, Yahoo, PGP servers, GoogleGroups, etc , but I intend to add many more.
Also, the library searches inside .pdf and .txt files for emails addresses and adds them to the list of found accounts.

For now, there are two main ways of performing a search, “the ruby way”

  1. Esearchy.create "domain.com" do |domain|
  2.    domain.maxhits = 500
  3.    domain.search
  4.    domain.clean {|e| e =~ /<|>/ }
  5.    domain.save_to_file "~/emails.txt"
  6.  end

and the more classic way in which users can create an Esearchy objetc and work on it

  1.  domain = Esearchy.new :query => "domain.com", :maxhits => 500
  2.   domain.search
  3.   domain.save_to_file "~/emails.txt"

For now , that’s it for now , but keep on tuned for more shitty code ajjajaa

(Via 自由編碼人.) Original Link: I’m back with some Code …


Pure-Ruby Readline: Released 0.1.2

Posted: May 19th, 2009 | Author: FreedomCoder | Filed under: Open Source, Programming, github, how-to | Tags: , , , | No Comments »

Well, well, less than 24 hours since my last blog post, I have more updates for you!

Thanks to GitHub, rb-readline, the Pure-Ruby Readline project I’ve mentioned earlier, have now two forks and 3 bugs fixed!

Thanks to Roger Pack and Jugyo !!!

Now, there is no gem for rb-readline, mainly because readline needs to be available even if RubyGems is not loaded (like on IRB).

So, to install the updated package:

  • Download rb-readline-0.1.2.zip
  • Extract to a folder and open a command prompt there
  • Execute ruby setup.rb

That should update the installed RbReadline, but just to verify:

ruby -rreadline -e 'puts Readline::RB_READLINE_VERSION'

The output should say 0.1.2

That’s all! Enjoy!

(Via DEV_MEM.dump_to(:blog) – Multimedia systems blog.) Original Link: Pure-Ruby Readline: Released 0.1.2


Take A Photo – Fotos instantáneas desde tu web

Posted: April 3rd, 2009 | Author: FreedomCoder | Filed under: Open Source, Programming, Rails, github | Tags: , , , , , | No Comments »

En la última semana estuve trabajando en agregar nuevas funcionalidades a un sitio de un cliente y entre los pedidos estaba una especie de Fotoblog para los usuarios (y bue, hay que pagar las cuentas a fin de mes :P ).

La cosa salió rápido, usando Paperclip que guarda las imágenes que se suben, se muestra en orden, etc, nada del otro mundo. Pero hablando con el cliente surgió la idea de hacer que el usuario se pueda tomar una foto directamente desde la web usando su webcam, así que después de decir “si, se debe poder hacer” mentalmente me salió un “doh!, que dije!“. Lo último que se dijo en esa reunión fue “Lo quiero:D .

Ya había visto juegos flash que utilizan la webcam así que empecé por ahí, para ver como sacaban un frame del video, lo cual era muy fácil. Lo siguiente era serializarla. A falta de algo mejor hice un serializador de imágenes muy pedorro, pero que anda (aunque es lento), que envía por POST la información de cada pixel.

La parte de Ruby fue fácil y decidí encapsularla en un plugin de Rails para poder reutilizarlo luego o por si a alguien más le sirve :) . Además se puede integrar con Paperclip o AttachmentFu para hacer la persistencia de la imagen en donde sea.

La única parte que usa Flash es el capturador de la cámara, porque otra no quedaba, pero luego el botón para tomar la foto y los eventos se manejan todo por Javascript.

El plugin tiene varios TODOs, pero por si a alguien le sirve está en github.

(Via El Futirifoken.) Original Link: Take A Photo – Fotos instantáneas desde tu web


Getting started with Jekyll

Posted: March 25th, 2009 | Author: FreedomCoder | Filed under: Open Source, Programming, Rails, github | Tags: , , , | Comments Off

Jekyll is a simple static site generator created by Tom Preston-Werner that is used as the engine behind the well-known GitHub Pages.

I must admit that the first time I heard about this, the idea did not grab my attention at all. But after reading some inspiring blog posts about it, everything started to make sense and I decided to give it a try on my new blog, and so far, I like it.

Installing Jekyll

The easiest way to install Jekyll is via RubyGems:

  
    $ sudo gem install mojombo-jekyll -s http://gems.github.com
  

Notice that Jekyll requires directory_watcher, liquid, open4 and maruku. They will be automatically installed by the gem install command.

Creating content

Basically, what Jekyll does is to take several .textile or .markdown files and translates them into html, optionally using layout templates to avoid duplicating the common areas of our blog on each post. So, all we need to do is place our own content files in the correct locations.

A typical Jekyll blog setup would be as follows:

  • An index.html file on the root directory that will serve as the home page of our blog.
  • One or more template layouts in the _layouts directory. These layouts can then be referenced from any other file by using the layout attribute in the YAML header. Also notice that layouts can be nested.
  • One .textile or .markdown file for each post in the _posts directory.
  • One .textile or .markdown file for each draft in the _drafts directory. Any posts in this directory will be ignored by Jekyll at generation time.
  • One or more .textile or .markdown files in the _includes directory. Any files located in this directory can be included into another file with the include tag.

For a starting point, you might want to take a look at Tom Preston-Werner’s TPW repository.

Generating the blog

Once that the basic layout and content of our blog was set up, we are ready for telling Jekyll to generate our site:

  
    $ jekyll
  

If everything goes well, by now we should have our brand new Jekyll-powered blog generated on the _site directory.

We can also run Jekyll with the --server flag in order to test the generated site:

  
    $ jekyll --server
  

This flag tells Jekyll to launch a WEBrick server instance. Now we can point our web browser to http://localhost:4000 and test the generated site locally.

Publishing everything

At this point, we can just ftp the contents of the _site directory to our web site and we’re done.

However, a much better solution would be to create a remote git repository and add some git hooks there that take care of generating the site for us each time we do a simple git push. That is exactly the setup I am using to maintain this blog, and I will be writing about it in a future post.

Conclusion

This solution is definitely not for everyone. But if you are a programmer, and especially if you spend most of your day working with a text editor and a terminal window opened, then you may find the combination of Jekyll, Git, and your editor of choice (vim, in my case, but Emacs, TextMate or any other would work just fine, of course) more appealing than any traditional blog software.

(Via matflores.com.) Original Link: Getting started with Jekyll


RubyInstaller repository relocated

Posted: March 20th, 2009 | Author: FreedomCoder | Filed under: Open Source, Programming, Windows, github | Tags: , , | Comments Off

This is a quick post to let everybody interested in One-Click Ruby Installer project that the repository got relocated.

From http://github.com/luislavena/rubyinstaller

To http://github.com/oneclick/rubyinstaller

I’ve added a note there just in case. All the code up-to-date got migrated, so no loss.

(Via DEV_MEM.dump_to(:blog) – Multimedia systems blog.) Original Link: RubyInstaller repository relocated