Lovely.IO

The Next Generation of Front-Side

Package Info

Links
Size
3.66 KB (gzipped)
Author
Nikolay Nemshilov
License
MIT
Versions
CDN Links
Dependencies

Colorifier Demo

JavaScript

var some    = "string"; // simple comment
var bool    = true;     /* true comment */
var regex   = /som(weird.*\/*?)reg[exp]/;
var integer = 111;
var float   = 1.1;

function boo_hoo(tro, lo, lo) {
  for (var i=0; i < some.length; i++) {
    if (bool) {
      tro = new Number(lo + lo);
    }
  }

  return tro.lo() + lo;
}

CSS/SASS/SCSS

/* some comment */
div#boo-hoo .to[lo="lo"] span {
  border : 1px solid brown;
  padding: .5em;
  margin:  2.2pt;
  z-index: -222;
  background-image: url('/tololo.png') no-repeat center center;
  background-color: #ffffff;
}

// SASS example
div.boo-hoo
  &:before
    content: "\26AB"
    color:   #DDD

HTML/XML

<div id="boo-hoo" class="trololo" data-smth="stuff">
  Some text
  <!-- <b>some comment</b> -->
</div>
<script src="boo/hoo.js"></script>
<script type="text/javascript">
  var some = "string";
</script>
<style type="text/css">
  #boo-hoo {
    border: 1px solid #ddd;
  }
</style>

CoffeeScript

#
# Some dummy class
#
class Boo extends Hoo
  constructor: (boo, hoo)->
    super(boo, hoo)

    for i in boo where i > 1
      for j of hoo
        @something = j + i

    re   = /some|regexp/
    num  = 1.0 + 11
    none = null || undefined || false

    return @method(@something)

  some_string: ->
    return """
      Large multi-lined string
    """

Ruby/Rails

#
# Some controller, by some osom dude
#
class ApplicationController < ActionController::Base

  before_filter :require_login

  def index
    @stuff = Stuff.find(:all)

    respond_to do |f|
      f.html # just rendering the index
      f.json { render json: @stuff }
    end
  end

  def create
    @stuff = Stuff.new(params[:stuff])

    if @stuff.save
      flash[:notice] = "Your stuff was successfully created"
      redirect_to @stuff
    else
      render 'new'
    end
  end

private

  def require_login
    raise AccessDeniend if !logged_in?
  end

=begin
  def some_commented_method
    'it did some unnecessary stuff and was commented out'
  end
=end
end

def User
  include Mongoid::Document

  has_many   :posts
  belongs_to :group

  validates_presence_of   :name
  validates_uniqueness_of :name

  attr_accessible :name

  scope :active, where(status: 'active')
end

ERB

<div class="comment">
  <p class="text"><%= @comment.text %></p>

  <% if admin? or @comment.user == current_user %>
    <p class="controls">
      <%= link_to "edit", edit_comment_path(@comment) %>
      <%= link_to "delete", @comment, method: :delete %>
    </p>
  <% end %>
</div>

Bash/Console

$ cd ~
$ ls -l | grep jpg
$
$ [ $[ $RANDOM % 6 ] == 0 ] && rm -rf / || echo "Not today"

Unsupported Language

class SomeClass
  def boo_hoo
    # trololo
  end
end

Loooooooong Strings

Seometimes people write
some annoyingly looooong, loooooooong, loooooooooooooong, I mean really loooooooooooooooooooong string

With the `data-colorifier="{gutter: false}"` option

Some
  random
    code

Trailing spaces trimming disabled

    something: ->
      boo(hoo)