This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
tenant.invoices.joins(:line_items) | |
.includes(line_items:[:accounting]) | |
.where('line_items.type=?', 'SimpleLineItem') | |
.where('line_items.description ilike ?', '%er%') | |
.map(&:line_items).flatten | |
.map(&:description) | |
.select{|x| x.match(/er/i)} | |
.sort{|a,b| a.downcase<=>b.downcase} | |
.uniq.first(5) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Use Gists to store code you would like to remember later on | |
console.log(window); // log the "window" object to the console |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
set background=dark | |
colorscheme railscasts " base16-railscasts railscasts | |
set relativenumber " show relative line numbers |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
set -e | |
# Example init script, this can be used with nginx, too, | |
# since nginx and unicorn accept the same signals | |
# Feel free to change any of the following variables for your app: | |
TIMEOUT=${TIMEOUT-60} | |
APP_ROOT=/path/to/your/app/current | |
PID=$APP_ROOT/tmp/pids/unicorn.pid | |
ENVIRONMENT=production |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# detect `$rvm_path` | |
if [ -z "${rvm_path:-}" ] && [ -x "${HOME:-}/.rvm/bin/rvm" ] | |
then rvm_path="${HOME:-}/.rvm" | |
fi | |
if [ -z "${rvm_path:-}" ] && [ -x "/usr/local/rvm/bin/rvm" ] | |
then rvm_path="/usr/local/rvm" | |
fi | |
# load environment of current project ruby | |
if |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1. Set appropriate permissions to the file | |
$ chmod 755 mongobackup | |
Then add the following entry to your crontab list | |
------------------------------- | |
@daily /home/user/mongobackup | |
------------------------------- |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
From my point of view, the gems that I’ll show later in this article represent the best options to develop in an Agile and DRY way and to achieve complex solutions in the shortest time possible. | |
These gems are the “core” of each our Gemfile because they allow to solve the most common problems that face in every application. In support of these gems, there are lot of gems that allow you to develop social functions, audit templates, integration with external APIs and more. | |
Devise (https://rubygems.org/gems/devise): Since some years ago, it represents the authentication mechanism preferred by all Rails developers. Powerful, flexible, allows to integrate with OAuth authentication systems with a minimal effort. | |
Haml (https://rubygems.org/gems/haml): Allows you to write valid XHTML concisely. The learning curve is relatively short. | |
Gritter (https://rubygems.org/gems/gritter): After years of flash messages in the classic div in the page, we moved to Growl like notifications. Thanks to these pop-ups, we can s |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require_relative "task" | |
desc "Send an invite" | |
task :invite do |name, email| | |
puts "Invitation sent to '#{name} <#{email}>'" | |
end | |
# Example: | |
# | |
# $ rake invite "Paul Engel" [email protected] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
GR_UPPERS = { | |
"Α" => "α", "Β" => "β", "Γ" => "γ", "Δ" => "δ", "Ε" => "ε", "Ζ" => "ζ", | |
"Η" => "η", "Θ" => "θ", "Ι" => "ι", "Κ" => "κ", "Λ" => "λ", "Μ" => "μ", | |
"Ν" => "ν", "Ξ" => "ξ", "Ο" => "ο", "Π" => "π", "Ρ" => "ρ", "Σ" => "σ", | |
"Τ" => "τ", "Υ" => "υ", "Φ" => "φ", "Χ" => "χ", "Ψ" => "ψ", "Ω" => "ω" | |
} | |
GR_ALPHA = [ | |
"ἀ", "ἁ", "ἂ", "ἃ", "ἄ", "ἅ", "ἆ", "ἇ", | |
"Ἀ", "Ἁ", "Ἂ", "Ἃ", "Ἄ", "Ἅ", "Ἆ", "Ἇ", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'formula' | |
class Elasticsearch < Formula | |
homepage 'http://www.elasticsearch.org' | |
url 'http://download.elasticsearch.org/elasticsearch/elasticsearch/elasticsearch-0.90.7.tar.gz' | |
sha1 '6cdfe366f3496b587bf440e153567d635ab64559' | |
head 'https://github.com/elasticsearch/elasticsearch.git' | |
depends_on 'maven' if build.head? |
NewerOlder