Skip to content

Instantly share code, notes, and snippets.

Avatar
🌴
work work work

Alexii Carey elchingon

🌴
work work work
View GitHub Profile
@elchingon
elchingon / old_file_killer.rb
Created Jan 9, 2018 — forked from pelgrim/old_file_killer.rb
A Ruby script to delete files older than X days in a given directory.
View old_file_killer.rb
#!/usr/bin/env ruby
# A Ruby script to delete files older than X days in a given directory. Pretty simple.
# Like this: file_control.rb /User/pelgrim/Documents '*.pdf' 7
# The command above you remove ALL your pdfs inside Documents older than SEVEN DAYS.
# Quickly written by pelgrim < guskald at gmail dot com >
unless ARGV.size == 3
puts "Usage: file_control <directory> <filename pattern> <max age>"
exit 1
View clear-sidekiq-jobs.sh
# 1. Clear retry set
Sidekiq::RetrySet.new.clear
# 2. Clear scheduled jobs
Sidekiq::ScheduledSet.new.clear
# 3. Clear 'Processed' and 'Failed' jobs
@elchingon
elchingon / customers.sql
Created Aug 25, 2016 — forked from leek/README.md
Magento - Delete All Test Data
View customers.sql
SET FOREIGN_KEY_CHECKS=0;
-- Customers
TRUNCATE `customer_address_entity`;
TRUNCATE `customer_address_entity_datetime`;
TRUNCATE `customer_address_entity_decimal`;
TRUNCATE `customer_address_entity_int`;
TRUNCATE `customer_address_entity_text`;
TRUNCATE `customer_address_entity_varchar`;
TRUNCATE `customer_entity`;
View angular.filters.nl2br.js
/*
# Usage in html template:
"xxx | nl2br"
<div ng-bind-html=" YourString | nl2br "></div>
or:
View cancan.rb
# Hack to get strong_parameters working
CanCan::ControllerResource
class CanCan::ControllerResource
protected
# Before using @params[whatever], CanCan will try calling whatever_params
def resource_params_by_namespaced_name
@controller.send(:"#{extract_key(namespaced_name)}_params")
rescue NoMethodError
You can’t perform that action at this time.