Skip to content

Instantly share code, notes, and snippets.

@pcreux
pcreux / pipable.rb
Last active June 12, 2018 17:08
*nix has pipes, Elixir has pipes, Ruby deserves pipes.
# Elixir has pipes `|>`. Let's try to implement those in Ruby.
#
# I want to write this:
#
# email.body | RemoveSignature | HighlightMentions | :html_safe
#
# instead of:
#
# HighlightMentions.call(RemoveSignature.call(email.body)).html_safe
#
@PetrKaleta
PetrKaleta / Caffeinated.coffee
Created January 8, 2012 21:38
Micro JavaScript library written in CoffeeScript to solve my needs when creating mobile web apps for iOS.
###
Caffeinated.js 1.0.1
(c) 2012 Petr Kaleta, @petrkaleta
Caffeinated.js is freely distributable under the MIT license.
Micro JavaScript library written in CoffeeScript to make my life easier when creating mobile web apps for iOS.
I don't like extending built-in JavaScript objects, so I've created this lib as an separate object.
I used underscore identifier to make its calls short as possible. So please do not mess this lib with gorgeous
Underscore.js lib by Jeremy Ashkenas, DocumentCloud Inc.
Some methods are inspired or borrowed from popular JavaScript frameworks like jQuery, Underscore.js and Prototype.js
@PetrKaleta
PetrKaleta / gist:1527710
Created December 28, 2011 11:57
Simple OOP pattern
log = (o) -> console.log o
# -------------- CLASS DEFINITIONS -------------
# Private methods are starting with underscore, but this is just for better readability
class SimpleOOPPattern
@classProperty: 'le class property'
@classMethod: ->
'le class method'
publicProperty: 'le public property'