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
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] ||= [] |
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
#!/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" |
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
var wiget = new Class({ | |
Includes: [Class.MethodMutators], | |
something: function () { | |
return new Element('div'); | |
}.mutator('setter'), | |
onComplete: function () { | |
this.hide(); | |
}.mutator('bind'), |