Skip to content

Instantly share code, notes, and snippets.

View ikenfin's full-sized avatar

Tominov Sergey ikenfin

View GitHub Profile
@ikenfin
ikenfin / gist:0501aa78b3e1885265c5
Created April 30, 2014 07:02
Noscript redirect
<noscript>
<meta http-equiv="refresh" content="0; URL=http://URL.HERE/badbrowser/">
</noscript>
@ikenfin
ikenfin / JQCompatibleBlock.js
Created May 23, 2016 09:34
Jquery compatible SirTrevor block
/*
JQCBlock - jquery compatible sir trevor block (old style)
it may be usefull for legacy jquery dependent code
*/
SirTrevor.JQCompatibleBlock = SirTrevor.Block.extend({
$ : function(selector) {
return $(this.el).find(selector);
}
});
@ikenfin
ikenfin / user-exit-example.js
Created September 20, 2016 10:31
Пример определения ухода пользователя
/*
Очередь фиксированного размера
*/
function fixedSizeQueue(size) {
var queue = Array.apply(null, []);
queue.fixedSize = size;
queue.trimHead = fixedSizeQueue.trimHead;
queue.push = fixedSizeQueue.push;
return queue;
@ikenfin
ikenfin / GitCommitEmoji.md
Created January 25, 2018 23:32 — forked from parmentf/GitCommitEmoji.md
Git Commit message Emoji
# some more ls aliases
alias ll='ls -alF'
alias la='ls -A'
alias l='ls -CF'
alias c='clear'
# git aliases
alias gad='git add'
alias gcm='git commit -m'
alias gp='git push'
@ikenfin
ikenfin / jwtRS256.sh
Created January 24, 2019 20:18 — forked from ygotthilf/jwtRS256.sh
How to generate JWT RS256 key
ssh-keygen -t rsa -b 4096 -m PEM -f jwtRS256.key
# Don't add passphrase
openssl rsa -in jwtRS256.key -pubout -outform PEM -out jwtRS256.key.pub
cat jwtRS256.key
cat jwtRS256.key.pub
<?php
/*
Set my_theme_t function as allowed for pods echo tag
*/
function my_theme_pods_template_echo_tag_allowed_functions($funcs) {
return array_merge($funcs, array('my_theme_t'));
}
add_filter('pods_template_echo_tag_allowed_functions', 'my_theme_pods_template_echo_tag_allowed_functions');
/*
Add "echo" tag to Pods Template
@ikenfin
ikenfin / TestComponent.js
Last active May 17, 2020 17:25
Is it normal way to use React?:)
import React from 'react'
import * as R from 'ramda'
// Group data by day
// [ {*}, ... ] -> { x: [*], ... }
const groupByDay = R.groupBy(item => {
const date = new Date(parseInt(item.date))
return date.getDate()
})
<?php
/*
Родительский класс для XML импортеров.
*/
class AbstractAdvertisementXMLReader {
protected $reader;
protected $result = array();
@ikenfin
ikenfin / Borders bookmarklet
Created November 6, 2020 23:37
Bookmarklet to show borders for divs
javascript:if(!window.__debug_div_borders_inited) { var sheet = document.styleSheets[0]; sheet.insertRule('body.__debug_div_borders div { outline: 1px solid green; }', ((sheet.cssRules && sheet.cssRules.length) || 0)); window.__debug_div_borders_inited = true; } document.body.classList.toggle('__debug_div_borders');void(0);