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 Admin::DelayedJobsController < AdminController | |
# GET /admin/delayed_jobs | |
def index | |
@delayed_jobs = Delayed::Backend::Mongoid::Job.desc(:created_at) | |
.paginate :page => params[:page], :per_page => 20 | |
end | |
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
module ActiveSupport::Callbacks::ClassMethods | |
def without_callbacks(callbacks, &block) | |
saved = {} | |
callbacks.each do |callback| | |
saved[callback] = instance_method(callback) | |
remove_method(callback) if respond_to?(callback) | |
define_method(callback){ true } | |
end | |
begin |
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 branch --merged | grep -v master | xargs git branch -d | |
git branch -r --merged | awk -F'/' '/^ *origin/{if(!match($0, /(>|master)/)){print $2}}' | 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
function( d ) { | |
// Create a copy of this date object | |
var target = new Date(d.valueOf()); | |
// ISO week date weeks start on monday | |
// so correct the day number | |
var dayNr = (d.getDay() + 6) % 7; | |
// Set the target to the thursday of this week so the |
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
# see https://github.com/amatsuda/kaminari/issues/56 and https://github.com/amatsuda/kaminari/pull/140 | |
module Kaminari | |
# = Helpers | |
module ActionViewExtension | |
extend ::ActiveSupport::Concern | |
module InstanceMethods | |
def page_entries_info(collection, options = {}) | |
collection_name = options[:collection_name] || (collection.empty?? 'entry' : collection.first.class.name.underscore.sub('_', ' ')) | |
if collection.num_pages < 2 |
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
require 'rubygems' | |
require 'selenium-webdriver' | |
path = File.expand_path("test.html") | |
File.open(path, "w") { |io| io << DATA.read } | |
browser = Selenium::WebDriver.for :firefox # replace :firefox with the browser you're having trouble with | |
begin | |
browser.get "file://#{path}" |
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
# monkey patch frozen string bug, see https://github.com/dblock/spreadsheet/commit/164dcfbb24097728f1a7453702c270107e725b7c | |
module Spreadsheet | |
module Encodings | |
def client string, internal='UTF-16LE' | |
string = string.dup | |
string.force_encoding internal | |
string.encode Spreadsheet.client_encoding | |
end | |
def internal string, client=Spreadsheet.client_encoding | |
string = string.dup |
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
function TJadeMainForm.PseudoUpper(iStr: string): string; | |
var | |
stNum: string; | |
stDes: string; | |
stNam: string; | |
stPre: string; | |
stTmp: string; | |
begin | |
if JadeTable.State <> dsEdit then JadeTable.Edit; | |
iStr := Trim(LowerCase(iStr)); |
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 Rails.env.production? | |
require 'new_relic/agent/instrumentation/controller_instrumentation' | |
module NewRelic | |
module Agent | |
module Instrumentation | |
module API | |
def newrelic_request_headers | |
@newrelic_request.env |
OlderNewer