Skip to content

Instantly share code, notes, and snippets.

View Paxa's full-sized avatar

Pavel Evstigneev Paxa

View GitHub Profile
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
@Paxa
Paxa / gist:4390042
Created December 27, 2012 17:16 — forked from ulitiy/gist:4389722
def make_square(n)
height = Math.sqrt(n)
throw "Input incorrect" unless height == height.to_i
x = ((height - 1) / 2).floor
y = ((height - 1) / 2).ceil
height = height.to_i
direction = 0
mat = []
(0 .. n - 1).each do |i|
mat[y] ||= []
@Paxa
Paxa / basic.ru
Created October 20, 2012 02:51 — forked from charger/basic.ru
Async request handling with sinatra and EM, freeze if request not exist URL
#!/usr/bin/env rackup -Ilib:../lib -s thin
# async message handling
# using gem https://github.com/raggi/async_sinatra
require 'sinatra/async'
require "em-http-request"
require "em-synchrony"
require "em-synchrony/em-http"
@Paxa
Paxa / gist:743270
Created December 16, 2010 10:37 — forked from rwz/gist:743264
var wiget = new Class({
Includes: [Class.MethodMutators],
something: function () {
return new Element('div');
}.mutator('setter'),
onComplete: function () {
this.hide();
}.mutator('bind'),