Rubygems by murb

One of the important rules in the ruby community is DRY: Don’t Repeat Yourself. Hence every now and then, to prevent myself from repeating or simply to keep a project’s code clean, I create a rubygem that solves the issue. Rubygems are small pieces of code (hence gems) that solve a particular problem that can be easily exchanged between ruby-projects.

SocialLinker

An article, posted almost 8 years ago filed in ruby, rubygem, gem, social_linker, rails, rubygems by murb, share, privacy, google+, facebook, google & twitter.

I had a few projects that I thought could use some share 'buttons', but I didn't like to include the JavaScript loaded and privacy invading share buttons that the networks try to sell you by default. Neither did I like to concatenate the links with all variables required for each project… so I wrote a small rubygem on a back and forth train trip (#ilovetrains ;)): social_linker.

The idea is that you share something about a certain subject, hence you initalize the SocialLinker::Subject and then you'll be able to generate share links from it:

subject.share_link(:facebook)

How it works

Initialize the subject with enough material to generate links from, such as the page's url, maybe the media url (mainly for Pinterest type-shares), a description, tags etc.

For example, initialize the SocialLinker::Subject as follows:

social_linker_subject = SocialLinker::Subject...

Continue reading...

KeywordFinder gem released

An article, posted more than 8 years ago filed in opensource, gem, ruby & rubygems by murb.

For a project I'm working on, I decided to develop some functionality in a separate gem, so the project doesn't get cluttered too much with special librarly like classes. And since I like open source, I've got something to share with you.

We were dealing with the following situation:

Given a set of the following keywords: "aardappelen", "zachtkokende aardappelen", "zout", "schimmelkaas", "kaas", "oude harde kaas", "kikkererwten", "maïs", "bruine bonen", "shiitake", "boter"

Can you recognize:

"een grote pan zachtkokende aardappelen met een snufje zout"=>["zachtkokende aardappelen", "zout"],
"schimmelkaas" => ["schimmelkaas"],
"(schimmel)kaas" => ["schimmelkaas"],
"old amsterdam (maar een andere oude harde kaas kan natuurlijk ook)" => ["oude harde kaas"],
"g (verse) shiitake in bitesize stukjes gesneden" => ["shiitake"],
"pot hak bonenmix (kikkererwten maïs kidney en bruine bonen) afgespoeld en uitgelekt" => ["kikkerwerwten", "maïs", "bruine bo...

Continue reading...

Introducing Workbook, a new rubygem

Sorry non-techies, this is really for (ruby-)techies.

For some time I've been working on a ruby gem that helps me on my project work, and may also help other ruby programmers, to work with table imports and exports more easily. Although there are other gems that allow you to read and write to different formats, of which the roo-gem is probably the most well know, I was particularly interested in writing Excel files based on templates.

I wanted to offer my clients more user-friendly Excel files that used some of the more advanced functionality of modern Spreadsheets (AutoFilter, printer styles) that couldn’t be offered by just manipulating styles and formatting using the existing rubygems. Which got me started to think about creating templates to start from, instead of starting from scratch using one of the Gems. Using another Excel file, however, wasn’t as easy as expected and here is where the Workbook gem comes in: to make that easier. Ad…

Continue reading...

Introducing Web Page Archiver (new ruby gem)

An article, posted almost 12 years ago filed in html, website, ruby, gem, archive, web page archiver, base64, data uri, mhtml, mime html & rubygems by murb.

To the ruby-folks (ruby is a programming language). Just a quick note to inform you that I've coded a new ruby gem:

> Web page archiver is a gem for creating web page archives: single files that contain images, Javascript, CSS, and the actual HTML. Of course you may zip these files, but there is hardly any support for opening and viewing such files without first requiring the user to extract the files before viewing. The solution offered in this gem is either MHTML or HTML with no external references. MHTML (or MIME HTML) is the default archive format for Internet Explorer and Opera, and can also be read in these browsers. HTML with no external references is not written by any browser as a standard archive format (that I know of) but can be read by any browser, as long as it has support for the Data URI-scheme (all modern browsers, although size limits apply to IE8).

More on the Web Page Archiver github page.

Continue reading...

murb blog