Skip to content

Instantly share code, notes, and snippets.

View 0m3r's full-sized avatar

Oleksandr Krasko 0m3r

View GitHub Profile
@0m3r
0m3r / gist:7578756
Last active March 7, 2017 09:03
Find every translating string at Magento extension code Mage::helper('your_ext')->__('Email')
grep "('your_ext')-.__\(.*\)" -Roh .| sed "s/.*__([\"']//" | sed "s/[\"'].*//g" | sort | uniq | sed "s/\(.*\)/\"\1\",\"\1\"/"
@0m3r
0m3r / ajaxpro.js
Created March 7, 2014 14:01
ajaxpro uenc fix
request.url = request.url.replace(/\/uenc\/[a-zA-Z0-9,]+\//, '/');
@0m3r
0m3r / gist:11030012
Created April 18, 2014 07:45
fast utf-8 fix for ajaxpro
<?php
$_html = $block->toHtml();
if (function_exists('mb_convert_encoding')) {
$_html = mb_convert_encoding($_html, "HTML-ENTITIES", "UTF-8");
}
return $_html;
@0m3r
0m3r / ligth_debug_backtrace.php
Last active November 4, 2020 13:14
ligth php debug_backtrace
<?php
$trace = debug_backtrace();
foreach ($trace as &$call) {
unset($call['object']);
unset($call['args']);
}
echo '<pre>';
print_r($trace);
echo '</pre>';
@0m3r
0m3r / osint_psb.rb
Last active August 29, 2015 14:16
osint psb4ukr
#!/usr/bin/ruby
require 'rubygems'
require 'nokogiri'
require 'open-uri'
require 'json'
class Psb4ukrorgParser
attr_accessor :data
@0m3r
0m3r / changes_per_filezilla_session
Last active February 1, 2017 15:02
Changes per filezilla session
cat /home/user/filezilla.log | grep "=> remote:" | cut -d: -f6 | sort | uniq
@0m3r
0m3r / ReflectionMethod_example.php
Last active July 7, 2020 17:39
find class method location
$classInstance = $this;
$methodName = 'getSome';
$r = new \ReflectionMethod($classInstance, $methodName);
var_dump($r->getFileName() . ':' . $r->getStartLine() . ' - ' . $r->getEndLine());
@0m3r
0m3r / build.js
Created December 26, 2018 15:29
Magento 2 Advanced js bundling config
{
// Usage:
// mv pub/static/frontend/Magento/luma/en_US pub/static/frontend/Magento/luma/en_US_orig
// r.js -o build.js baseUrl=pub/static/frontend/Magento/luma/en_US_origin dir=pub/static/frontend/Magento/luma/en_US
// Enable js minification with Uglify. Uncomment this out during development tomake builds faster
//optimize: 'none',
inlineText: true,
// Files that are required for all pages will be included in require.js file
deps: [
'jquery/jquery.cookie',
@0m3r
0m3r / onlinesetup
Last active April 25, 2019 08:21
OnlineSetup bash script (curl -s [raw url] | bash -s)
#!/bin/bash
DOMAIN=${1:-magento.local}
VERSION=${2:-2.3.1}
REPO=${3:-https://repo.magento.com/}
# REPO=${3:[email protected]:magento/magento2.git}
DIR=$DOMAIN
# Check availability of composer
hash composer 2>/dev/null || { echo >&2 "The script requires \"composer\" (https://getcomposer.org/download/)"; exit 1; }
#!/bin/bash
if test "$#" -eq 3; then
PACKAGE=${1}
VERSION=${2}
REQUIRE=${3}
else
PACKAGE="magento/product-community-edition"
VERSION=${1}
REQUIRE=${2}