alias mou='open -a Mou'
mou FILE.md
module Enum | |
def self.included(base) | |
#TODO: learn difference between extend and include (send :include, ) | |
base.extend ClassMethods | |
super | |
end | |
module ClassMethods | |
def enum(args) | |
# Constants |
#!/bin/bash | |
wget https://github.com/leonelgalan/sinatra_base/archive/master.zip | |
unzip master.zip | |
rm master.zip | |
mv sinatra_base-master $1 | |
LAST_RUBY=`curl 'http://ftp.ruby-lang.org/pub/ruby/1.9/' 2> /dev/null | ruby -e 'puts STDIN.lines.map { |x| /1\.9\.3-p\d+\b/.match(x) }.compact.last[0]'` | |
echo $LAST_RUBY > $1/.ruby-version | |
echo $1 > $1/.ruby-gemset |
If you read the title and thought I was going to talk about the gemstone, you are in the right place. This series is intended for non-developers to understand why some of us, developers, prefer Ruby over other languages.
"Ruby is simple in appearance, but is very complex inside, just like our human body" says Yukihiro "Matz" Matsumoto, its creator. After 7 years in school studying computer science, I didn't felt like doing "rocket science" the rest of my life. Not all computer scientists (let's say developers from know on) enjoy dealing with the underlying complexities of computers every day. While studying, my area of interest was to solve complex problems with simple technology and Ruby fitted like a glove.
This blog post started 8 months ago with this tweet. I have been coding for a while and every day I am pleasantly surprised about how pretty my code looks thanks to Ruby. The resul
ENV["RAILS_ENV"] ||= "test" | |
require File.expand_path('../../config/environment', __FILE__) | |
require 'rails/test_help' | |
class ActiveSupport::TestCase | |
ActiveRecord::Migration.check_pending! | |
# Setup all fixtures in test/fixtures/*.yml for all tests in alphabetical order. | |
# | |
# Note: You'll currently still have to declare fixtures explicitly in integration tests |
allItems = document.getElementsByTagName('*') | |
i = 0 | |
while i < allItems.length | |
if allItems[i].tagName isnt 'HTML' and allItems[i].tagName isnt 'BODY' | |
allItems[i].addEventListener 'mouseover', (event) -> | |
console.log event.target.style.border | |
event.target.setAttribute 'data-border', event.target.style.border | |
event.target.style.border = '2px solid #F00' | |
event.stopPropagation() | |
allItems[i].addEventListener 'mouseout', (event) -> |
If you read the title and thought I was going to talk about the gemstone, you are in the right place. This series is intended for non-developers to understand why some of us, developers, prefer Ruby over other languages.
This is a series of blog posts, read part 1 to see Ruby examples against other languages: PHP and Java.
===
I often see code written like this:
// This is a manifest file that'll be compiled into application.js, which will include all the files | |
// listed below. | |
// | |
// Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts, | |
// or vendor/assets/javascripts of plugins, if any, can be referenced here using a relative path. | |
// | |
// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the | |
// compiled file. | |
// | |
// Read Sprockets README (https://github.com/sstephenson/sprockets#sprockets-directives) for details |
rspec-stackprof
is "empty"stackprof
is written as a replacement for perftools.rb
stackprof.rb
to your spec/support
folder, which is loaded on rails_helper.rb
find . -name '*.js.coffee' -type f | while read NAME ; do mv "${NAME}" "${NAME%.js.coffee}.coffee" ; done | |
find . -name '*.css.scss' -type f | while read NAME ; do mv "${NAME}" "${NAME%.css.scss}.scss" ; done |