Skip to content

Instantly share code, notes, and snippets.

View procommerz's full-sized avatar

Denis procommerz

View GitHub Profile
@procommerz
procommerz / fl
Created May 18, 2019 19:12 — forked from McNull/fl
Open current directory in forklift
#!/bin/bash
# Open current directory in forklift
# Adapted from https://gist.github.com/elentok/6218781
# Adapted from comment https://gist.github.com/elentok/6218781#comment-891115
# Added optional path argument and removed using the clipboard buffer.
set -e
if [ -z "$@" ]; then
# Pry hack to show execution time
Pry.class_eval do
# Perform a read-eval-print.
# If no parameter is given, default to top-level (main).
# @param [Object, Binding] target The receiver of the read-eval-print
# @example
# Pry.new.rep(Object.new)
def rep(target=TOPLEVEL_BINDING)
target = Pry.binding_for(target)
result = re(target)
## Clear the processed stats
Sidekiq.redis {|c| c.del('stat:processed') }
## Clear the failed stats
Sidekiq.redis {|c| c.del('stat:failed') }
@procommerz
procommerz / rails_lazy_init.rb
Created December 4, 2014 17:48
Funny lazy init. pattern in Rails I rarely use
option_type = Spree::OptionType.where(name: opt_name).first_or_initialize do |o|
o.presentation = opt_name
o.save!
end
@procommerz
procommerz / new_gist_file.js
Created June 2, 2014 19:01
Fix Boostrap 3.1 .modal dialog ajax content load
$(document).ready(function() {
// Fix for bootstrap remote add-ons
$('[data-remote="true"][data-toggle="modal"]').on('click',
function(e) {
var $this = $(this)
var $remote = $this.attr('href')
var $modal = $($this.data('target') + ' .modal-content');
console.log($this);
console.log($remote);
$modal.load($remote);
@procommerz
procommerz / 0_reuse_code.js
Created May 12, 2014 05:18
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console