Go to RubyForge and download:
Then:
# linecache
% gem install linecache19-0.5.13.gem
<html> | |
<head> | |
</head> | |
<body> | |
<div id="header"> | |
--- Titolo e Testata --- | |
</div> | |
<div id="body"> | |
<div id="menu"> | |
--- Voci di Menu --- |
The first implementation was too long (8 LOCs) and referenced `options[:class]` 3 times (duplication). | |
After the refactoring, with two invocations and a single line of code the problem is solved. |
namespace :assets do | |
task :check => "assets:environment" do | |
# If the asset pipeline isn't enabled, safely exit. | |
if not Rails.application.config.assets.enabled | |
exit(0) | |
end | |
require 'sprockets/checker' | |
# Ensure that action view is loaded and the appropriate | |
# sprockets hooks get executed |
jQuery(function() { | |
function baseUri() { | |
return $('meta[name="base-uri"]').attr('content'); | |
} | |
jQuery.ajaxSetup({ | |
'beforeSend': function(xhr, settings) { | |
settings.url = baseUri() + settings.url; | |
return true; | |
} |
require 'test_helper' | |
shared_examples_for 'An Adapter' do | |
describe '#read' do | |
before do | |
@adapter.write(@key = 'whiskey', @value = "Jameson's") | |
end | |
it 'reads a given key' do | |
@adapter.read(@key).must_equal(@value) |
Go to RubyForge and download:
Then:
# linecache
% gem install linecache19-0.5.13.gem
# (c) 2012 Luca Guidi (lucaguidi.com) – Released under MIT License | |
# | |
# It prompts: | |
# *[master][~/Developer/epts]% rb:1.9.3-p0 | |
# | |
# Meaning: | |
# - The asterisk is for mark uncommitted git changes | |
# - In the square brackets are respectively: for the current git branch | |
# and for the current directory | |
# - The percent is the prompt |
# Example #1: Person | |
person = Node.create({ | |
type: 'person', | |
uri: 'http://people.com/people/23', | |
attrs: { birth_date: Time.parse('June 23, 1982').to_date } | |
}) | |
Node.tire.search(load: true) { filter :range, 'attrs.birth_date' => { lte: Time.zone.now } }.size # => 0 | |
# Example #2: Country |
#!/bin/bash | |
case "$1" in | |
'postgres') | |
postgres -D /usr/local/var/postgres | |
;; | |
'elasticsearch') | |
elasticsearch -f -D es.config=/usr/local/Cellar/elasticsearch/0.19.1/config/elasticsearch.yml | |
;; | |
esac |
#!/usr/bin/env ruby -w | |
# brew-services(1) - Easily start and stop formulas via launchctl | |
# =============================================================== | |
# | |
# ## SYNOPSIS | |
# | |
# [<sudo>] `brew services` `list`<br> | |
# [<sudo>] `brew services` `restart` <formula><br> | |
# [<sudo>] `brew services` `start` <formula> [<plist>]<br> |