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
ActiveAdmin::Dashboards.build do | |
# Add this section in your dashboard... | |
section "Background Jobs" do | |
now = Time.now.getgm | |
ul do | |
li do | |
jobs = Delayed::Job.where('failed_at is not null').count(:id) | |
link_to "#{jobs} failing jobs", admin_jobs_path(q: {failed_at_is_not_null: true}), style: 'color: red' | |
end |
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
# This file is copied to spec/ when you run 'rails generate rspec:install' | |
ENV["RAILS_ENV"] ||= 'test' | |
require 'spec_helper' | |
require File.expand_path("../../config/environment", __FILE__) | |
require 'rspec/rails' | |
require 'shoulda/matchers' | |
require 'foreigner-matcher' | |
require 'capybara/rspec' | |
# Requires supporting ruby files with custom matchers and macros, etc, in |
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
# This file was generated by the `rails generate rspec:install` command. Conventionally, all | |
# specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`. | |
# The generated `.rspec` file contains `--require spec_helper` which will cause this | |
# file to always be loaded, without a need to explicitly require it in any files. | |
# | |
# Given that it is always loaded, you are encouraged to keep this file as | |
# light-weight as possible. Requiring heavyweight dependencies from this file | |
# will add to the boot time of your test suite on EVERY test run, even for an | |
# individual file that may not need all of that loaded. Instead, make a | |
# separate helper file that requires this one and then use it only in the specs |
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
$ git remote prune origin | | |
git branch -r --merged origin/master | | |
grep origin | | |
grep -v '>' | | |
grep -v master | | |
xargs -L1 | | |
cut -d"/" -f2- | | |
xargs git push origin --delete |
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
module Concerns::URIField | |
extend ActiveSupport::Concern | |
included do | |
def self.ensure_valid_protocol_in_uri(field, default_protocol = "http", protocols_matcher="https?") | |
define_method "#{field}=" do |new_uri| | |
if new_uri.present? and not new_uri =~ /^#{protocols_matcher}:\/\// | |
new_uri = "#{default_protocol}://#{new_uri}" | |
end | |
super(new_uri) |
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
$('[id]').each(function(){ | |
var ids = $('[id="'+this.id+'"]'); | |
if(ids.length>1 && ids[0]==this) | |
console.warn('ID #'+this.id+' found '+ids.length+' times'); | |
}); |
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
namespace :fixtures do | |
namespace :s3 do | |
require 'fileutils' | |
def cms_export from, to | |
# create the fixtures files from DB | |
ComfortableMexicanSofa::Fixture::Exporter.new(from, to).export! | |
# get the bucket | |
bucket = AWS::S3.new.buckets[ENV['S3_BUCKET_FIXTURES']] |
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
# To delete all branches that are already merged into the currently checked out branch: | |
git branch --merged | grep -v "\*" | xargs -n 1 git branch -d |
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
echo "* Updating system" | |
sudo apt-get update | |
sudo apt-get -y upgrade | |
echo "* Installing packages" | |
sudo apt-get -y install build-essential libxml2-dev libxslt1-dev git-core nginx redis-server postgresql-client libpq5 libpq-dev curl nodejs htop | |
sudo locale-gen pt_PT.UTF-8 | |
sudo dpkg-reconfigure locales | |
echo "* Installing rvm" |
OlderNewer