View i18n_status.html.slim
1 2 3 4 5 6 7 8 9 10
h1 Missing and unused translations
 
- if @missing.present?
.panel.panel-default
.panel-heading: h3.panel-title #{@missing.leaves.count} missing keys
table.table.table-striped.table-condensed
thead: tr
th.text-right Locale
th Key
th Value
View object_enumerable.rb
1 2 3 4 5 6 7 8 9 10
class Object
def each(&block)
return to_enum(:each) { 1 } unless block
[self].each(&block)
end
include Enumerable
end
 
class NilClass
def each(&block)
View gist:9665022
1 2 3 4 5 6 7 8 9 10
Delivered-To: glex.spb@gmail.com
Received: by 10.52.103.9 with SMTP id fs9csp318329vdb;
Thu, 20 Mar 2014 07:31:14 -0700 (PDT)
X-Received: by 10.52.8.225 with SMTP id u1mr556372vda.64.1395325873937;
Thu, 20 Mar 2014 07:31:13 -0700 (PDT)
Return-Path: <bounce+f7da5c.ff052-glex.spb=gmail.com@itbyen.no>
Received: from mail-s77.mailgun.info (mail-s77.mailgun.info. [184.173.153.205])
by mx.google.com with ESMTP id of4si455498vcb.175.2014.03.20.07.31.09
for <glex.spb@gmail.com>;
View i18_status_controller.rb
1 2 3 4 5 6 7 8 9
require 'i18n/tasks/base_task'
 
...
def i18n_status
task = I18n::Tasks::BaseTask.new
@missing = task.missing_keys
@unused = task.unused_keys
end
...
View md-hl-code
1 2 3 4 5 6 7 8 9 10
#!/usr/bin/env ruby
 
def convert(lang, md)
md.gsub(/\t/, ' ' * 4).gsub(/((?:^\s{4}[^\n]*\n)+)/) {
"\n```#{lang}#{$1.gsub(/^[ ]{4}/, '')}```\n"
}
end
 
argv = ARGV.dup
path = argv.pop or raise 'pass path'
View inline-css-font.rb
1 2 3 4 5 6 7 8 9 10
#!/usr/bin/env ruby
require 'base64'
require 'open-uri'
 
# file or url
def get_css(src)
if src.start_with? 'http'
src = src.gsub('|', '%7C')
STDERR.puts "# GET #{src}"
# simulate modern browser to get woff
View gist:6338523
1 2 3 4 5 6 7 8 9 10
grep -n5 bootstrap-sass Gemfile.lock
13- specs:
14- jquery-datatables-rails (1.11.2)
15- jquery-rails
16-
17-GIT
18: remote: git://github.com/thomas-mcdonald/bootstrap-sass.git
19- revision: 571ba865e1cd01f583c5949446803b9f2cd21926
20- branch: 3
21- specs:
View ransacks_with_scopes_initializer.rb
1 2 3 4 5 6 7 8 9 10
# Patch for ransack (https://github.com/ernie/ransack) to use scopes
# Helps migrating from Searchlogic or MetaSearch
# Place this file into config/initializer/ransack.rb of your Rails 3.2 project
#
# Usage:
# class Debt < ActiveRecord::Base
# scope :overdue, lambda { where(["status = 'open' AND due_date < ?", Date.today]) }
# end
#
# Ransack out of the box ignores scopes. Example:
View trace
1 2 3 4 5 6 7 8 9 10
[GEM_ROOT]/bundler/gems/rpm-a063acda8e06/lib/new_relic/agent/stats_engine/transactions.rb:61
[GEM_ROOT]/bundler/gems/rpm-a063acda8e06/lib/new_relic/agent/instrumentation/action_controller_subscriber.rb:104
[GEM_ROOT]/bundler/gems/rpm-a063acda8e06/lib/new_relic/agent/instrumentation/action_controller_subscriber.rb:51
[GEM_ROOT]/gems/activesupport-4.0.0/lib/active_support/notifications/fanout.rb:96
[GEM_ROOT]/gems/activesupport-4.0.0/lib/active_support/notifications/fanout.rb:40
[GEM_ROOT]/gems/activesupport-4.0.0/lib/active_support/notifications/fanout.rb:40
[GEM_ROOT]/gems/activesupport-4.0.0/lib/active_support/notifications/fanout.rb:40
[GEM_ROOT]/gems/activesupport-4.0.0/lib/active_support/notifications/instrumenter.rb:36
[GEM_ROOT]/gems/activesupport-4.0.0/lib/active_support/notifications/instrumenter.rb:25
[GEM_ROOT]/gems/activesupport-4.0.0/lib/active_support/notifications.rb:159
View async_emails_i18n.rb
1 2 3 4 5 6 7 8 9 10
require 'resque_mailer'
require 'devise/async'
 
# pop and set locale from the args before running
module PerformWithLocale
def perform(*args)
I18n.with_locale(args.pop) do
super(*args)
end
end
Something went wrong with that request. Please try again.