Skip to content

Instantly share code, notes, and snippets.

🎯
Focusing

Diogo Gomes Alphabetus

🎯
Focusing
View GitHub Profile
@Alphabetus
Alphabetus / index.php
Last active Mar 16, 2020
get handlers for Magento Debugging on index.php
View index.php
/**
* NOTE:
* Retrieves the handlers used by Magento on frontend.
* Example:
* array(8) { [0]=> string(7) "default" [1]=> string(8) "cms_page" [2]=> string(13) "STORE_default" [3]=> string(29) "THEME_frontend_custom_default" [4]=> string(15) "cms_index_index" [5]=> string(22) "page_two_columns_right" [6]=> string(19) "customer_logged_out" [7]=> string(8) "cms_menu" }
**/
var_dump(Mage::app()->getLayout()->getUpdate()->getHandles());
@Alphabetus
Alphabetus / __readme.md
Created Feb 20, 2020 — forked from maxivak/__readme.md
Tree with ancestry. Rails
View __readme.md

Contents:

  • show full path for the item
  • show tree in ol li
  • show tree in dropdown select

Show full path for item

  • one item
View translations.js
var translations = {
// hindi
hindi: {
// story 01
1: [
"मध्यस्थ: एक शाम तेनाली रामा अपनी जॉय फिर तेनाली रामा की पत्नी को देखकर बहुत खुश होकर महल से घर लौटा। वसुधा ने उससे पूछा।",
"पत्नी: क्या तुम आज बहुत खुश नहीं लग रहे हो?",
"रामा: हाँ। क्यों नहीं? मुझे आज खुश क्यों नहीं दिखना चाहिए?",
"पत्नी: क्यों क्या हुआ है?",
"रामा: ओह! वसुधा आज राजा कृष्णदेवराय ने अपने बगीचे में उगाए गए बैंगन से सब्जी बना कर उसे गर्म करने के बाद कढ़ी पर भोज के लिए सभी लोगों को आमंत्रित किया था। मैं वह भूल नहीं पा रहा हूँ।",
View table_for_story.html
<table data-storyid="100" border="0">
<tbody>
<tr>
<td>Speaker 1:</td>
<td>sentence A.</td>
</tr>
<tr>
<td>Speaker 2:</td>
@Alphabetus
Alphabetus / async_rake.rb
Created Sep 19, 2019 — forked from tompave/async_rake.rb
how to run rake tasks asynchronously from controllers by spawning child processes
View async_rake.rb
class ApplicationController < ActionController::Base
def perform_async(task, options = {})
options[:rails_env] ||= Rails.env
env_vars = options.map { |key, value| "#{key.to_s.upcase}='#{value.to_s}'" }
env_vars_string = env_vars.join(' ')
Process.fork {exec("#{env_vars_string} bin/rake #{task}")}
end
end
@Alphabetus
Alphabetus / redis.rb
Last active Sep 18, 2019 — forked from pubis/redis.rb
Redis config and initialization for rails
View redis.rb
#config/initializers/redis.rb
require 'redis'
require 'redis/objects'
REDIS_CONFIG = YAML.load( File.open( Rails.root.join("config/redis.yml") ) ).symbolize_keys
dflt = REDIS_CONFIG[:default].symbolize_keys
cnfg = dflt.merge(REDIS_CONFIG[Rails.env.to_sym].symbolize_keys) if REDIS_CONFIG[Rails.env.to_sym]
$redis = Redis.new(cnfg)
Redis::Objects.redis = $redis
View gist:90f345d9cf810e787ac0501c7db672de
c# DIFF REPORT:# 18-07-2019 11:50:08
# dif number 1
---
:title: Filter products by collection
:dates:
:generated_at: 18.18.2019 - 11:50:08
:post_date: July 17, 2019
:meta:
:tag: Products
View gist:d4d89dad1e8157558970b75c69e3dbaf
# DIFF REPORT:# 27-06-2019 20:23:16
# dif number 1
---
:title: All of your discounts in one place
:dates:
:generated_at: 27.27.2019 - 20:23:16
:post_date: June 27, 2019
:meta:
:tag: Discounts
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
@Alphabetus
Alphabetus / gist:000f9f7461ce0136f480945ce0c31dc1
Last active Jun 25, 2019
Selectize.js update custom tax container
View gist:000f9f7461ce0136f480945ce0c31dc1
jQuery('.single-option-selector').selectize({
{% if shop.currency_code == "EUR" %}
{% assign money_symbol = "€" %}
{% endif %}
{% if shop.currency_code == "USD" %}
{% assign money_symbol = "$" %}
{% endif %}
You can’t perform that action at this time.