Skip to content

Instantly share code, notes, and snippets.

@humpok
humpok / reset_sidekiq.rb
Created September 13, 2018 13:38
Delete All Sidekiq Batches and Jobs
Sidekiq::BatchSet.new.each { |batch| Sidekiq::Batch::Status.new(batch.bid).delete }
Sidekiq::Queue.all.each(&:clear)
DELIMITER $$
DROP PROCEDURE IF EXISTS drop_index_if_exists $$
CREATE PROCEDURE drop_index_if_exists(in theTable varchar(128), in theIndexName varchar(128) )
BEGIN
IF((SELECT COUNT(*) AS index_exists FROM information_schema.statistics WHERE TABLE_SCHEMA = DATABASE() and table_name =
theTable AND index_name = theIndexName) > 0) THEN
SET @s = CONCAT('DROP INDEX `' , theIndexName , '` ON `' , theTable, '`');
PREPARE stmt FROM @s;
EXECUTE stmt;
@humpok
humpok / postJSON.js
Created June 3, 2016 14:47
postJSON function jQuery extension
jQuery.extend({
postJSON: function(url, data, callback) {
return jQuery.ajax({
type: "POST",
url: url,
data: JSON.stringify(data),
success: callback,
dataType: "json",
contentType: "application/json",
processData: false