View active_record_extension.rb
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 ActiveRecordExtension | |
extend ActiveSupport::Concern | |
module ClassMethods | |
# Add a SELECT SUM() by CASE to query. | |
# | |
# @param cases [Hash(:attr, :val, :operand), Array(Hash(:attr, :val, :operator))] | |
# @param sum_field [Symbol, String] |
View magento_permissions.sh
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
#Set Magento root directory permissions. Call using the following: | |
# curl -sL https://goo.gl/b1NkHW | sudo bash | |
#!/bin/bash | |
if [ ! -f ./app/etc/local.xml ]; then | |
echo "-- ERROR" | |
echo "-- This doesn't look like a Magento install. Please make sure" | |
echo "-- that you are running this from the Magento main doc root dir" | |
exit | |
fi |
View infinite_scroll.js.coffee
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
window.App ||= {} | |
class App.GemgentoCategories extends App.Base | |
show: => | |
new App.ProductGrid() | |
@infiniteScroll() | |
return | |
View rsvp_sxsw_controller.rb
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
# app/controllers/rsvp_sxsw_controller.rb | |
class RsvpSxswController < ApplicationController | |
MAILCHIMP_API_KEY = "XXXX" | |
MAILCHIMP_LIST_ID = "XXXX" | |
# GET /rsvp_sxsw | |
def new | |
end |
View sidekiq.rake
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
namespace :sidekiq do | |
task merge_stale_queues: :environment do | |
ec2_private_ips ||= AWS::EC2.new(region: 'us-west-2').instances.map { |instance| instance.private_ip_address } | |
merged = false | |
puts "EC2 Private IPs: #{ec2_private_ips}" | |
Sidekiq.redis do |conn| | |
private_queues = conn.keys('queue:*_*_*') |
View models.rb
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 Order < ApplicationRecord | |
belongs_to :customer | |
def totals_by_customer | |
Order.all.pluck(:customer).distinct.map do |customer| | |
[customer, customer.orders.sum(:total))] | |
end | |
end | |
end |
View gdb_output.txt
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
Thread 22 (Thread 0x7fa34f0b0700 (LWP 12916)): | |
#0 0x00007fa34e72afdd in poll () at ../sysdeps/unix/syscall-template.S:81 | |
#1 0x00007fa34eba6fbc in ?? () from /usr/lib/x86_64-linux-gnu/libruby-2.3.so.2.3 | |
#2 0x00007fa34e428184 in start_thread (arg=0x7fa34f0b0700) at pthread_create.c:312 | |
#3 0x00007fa34e73837d in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:111 | |
Thread 21 (Thread 0x7fa346635700 (LWP 12937)): | |
#0 0x00007fa34e72fc53 in select () at ../sysdeps/unix/syscall-template.S:81 | |
#1 0x00007fa34eba67d0 in rb_thread_fd_select () from /usr/lib/x86_64-linux-gnu/libruby-2.3.so.2.3 | |
#2 0x00007fa34ea9edaf in ?? () from /usr/lib/x86_64-linux-gnu/libruby-2.3.so.2.3 |
View worker1-process2.txt
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
Thread 22 (Thread 0x7f7e882e2700 (LWP 24112)): | |
#0 0x00007f7e878f1fdd in poll () at ../sysdeps/unix/syscall-template.S:81 | |
#1 0x00007f7e87dcbd9b in timer_thread_sleep (gvl=0x1ebcf28) at thread_pthread.c:1455 | |
#2 thread_timer (p=0x1ebcf28) at thread_pthread.c:1563 | |
#3 0x00007f7e875ef184 in start_thread (arg=0x7f7e882e2700) at pthread_create.c:312 | |
#4 0x00007f7e878ff37d in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:111 | |
Thread 21 (Thread 0x7f7e7bbf7700 (LWP 24116)): | |
#0 0x00007f7e878f6c53 in select () at ../sysdeps/unix/syscall-template.S:81 | |
#1 0x00007f7e87dd3c7b in rb_fd_select (n=<optimized out>, readfds=<optimized out>, writefds=<optimized out>, |
View calculate#calculate!.rb
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 calculate! | |
self.with_lock do | |
Octopus.using(:replica) do | |
self.class::CALCULATION_METHODS.each { |method| send(method) } | |
end | |
self.updated_at = self.calculated_at = Time.now | |
self.is_calculated = true | |
self.save!(touch: false) | |
end |
View delete_sidekiq_batch.rb
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
Sidekiq::BatchSet.new.each { |batch| Sidekiq::Batch::Status.new(batch.bid).delete } |
OlderNewer