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
[em-http-request, HTTParty, Net::HTTP, Net::HTTP (persistent), open-uri, RestClient, Typhoeus, Excon, Excon (persistent), Curb, Patron (persistent)] | |
+------------------------+----------+ | |
| tach | total | | |
+------------------------+----------+ | |
| Patron (persistent) | 0.223029 | | |
+------------------------+----------+ | |
| Curb | 0.235344 | | |
+------------------------+----------+ | |
| Typhoeus | 0.389802 | |
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 CachableMethod | |
def cachable(merhod_name) | |
#aliased_merhod_name = :"uncached_#{merhod_name}" | |
#alias_method aliased_merhod_name, merhod_name | |
method_proc = instance_method(merhod_name) | |
ivar_name = :"@#{merhod_name}" | |
define_method(merhod_name) do |*args, &proc| | |
if instance_variable_defined?(ivar_name) |
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
if (pg_native) { | |
var async = require('async'); | |
pg = { | |
connect: function (connectString, callback) { | |
var client = new pg_native; | |
client.original_query = client.query; | |
client.sqlQueue = async.queue(function (sql, callback) { |
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
#model | |
class Comment < ActiveRecord::Base | |
belongs_to :podcast | |
validates_presence_of :content | |
validates_presence_of :author_name | |
validates_presence_of :podcast_id | |
validates_length_of :author_name, :within => 2..40 | |
validates_length_of :author_url, :within => 5..200, :allow_blank => true | |
validates_format_of :author_url, :with => /^[^\"\'\\]*$/, | |
:message => "can't include backslash or bracket" |
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
class CommentsController < ApplicationController | |
def create | |
@podcast = Podcast.find params[:comment][:podcast_id] | |
params[:comment][:podcast_id] = nil | |
@comment = @podcast.comments.new params[:comment] | |
if @comment.save | |
flash[:notice] = "Comment writen" | |
redirect_to @podcast | |
else | |
@podcast = Podcast.find params[:comment][:podcast_id] |
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
<? | |
#controller | |
$bdks = $this->db->select('distinct year as name')->where('site', $_REQUEST['siteid'])->get('pers_to_date')->result(); | |
$this->my_view->view('admin/mailer/filter', array( | |
'users' => $users, | |
'total_rows' => $users_num, | |
'branches' => $this->db->get('branch')->result(), // бля, почему не branches ? |
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_frame').each(function (el) { | |
var html = el.get('html'); | |
var myIFrame = new IFrame({ | |
src: '', | |
styles: { | |
width: el.getStyle('width'), | |
height: el.getStyle('height').toInt() + 3, | |
border: 0, | |
padding: 0 | |
} |
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 file_tree files, sub = nil, &proc | |
res = "<ul #{'class="subdir"' if sub }>" | |
files.each do |file, value| | |
subdir = (value.class == Hash) ? file_tree(value, 1) { |a, b| proc.call a, b } : nil | |
res += proc.call file, subdir | |
end | |
res + '</ul>' | |
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
name: "QuickBox" | |
assets: | |
css: | |
- "css/quickbox.css" | |
js: | |
quickbox.js: general | |
a.js: "simple" | |
b.js: "simple, advaced" | |
c.js: "specific, advanced" |
OlderNewer