Skip to content

Instantly share code, notes, and snippets.

@arkadylukashov
arkadylukashov / filter.js
Created August 5, 2019 12:36
Vuex filter module
import _ from 'lodash'
export const state = () => ({
_contains: 'some',
_badges: null,
_topics: [],
_dates: [],
_upvotes: 0,
})
<template>
<div class="filter" @click="toggleFilter" :class="{'is-active': isShowFilter}">
<div class="filter__title" :class="{'has-filter': hasFilter}">
<IconFilter class="filter__icon" />
<span class="filter__text">Filter <span>by</span></span>
</div>
<ul class="filter__list">
<li class="filter__item"
v-for="(filter, i) in list"
:key="`filter.${i}`"
@arkadylukashov
arkadylukashov / combos.php
Created May 25, 2016 18:47 — forked from fabiocicerchia/combos.php
PHP - Generate all the possible combinations among a set of nested arrays.
/**
* Generate all the possible combinations among a set of nested arrays.
*
* @param array $data The entrypoint array container.
* @param array $all The final container (used internally).
* @param array $group The sub container (used internally).
* @param mixed $val The value to append (used internally).
* @param int $i The key index (used internally).
*/
function generate_combinations(array $data, array &$all = array(), array $group = array(), $value = null, $i = 0)
@arkadylukashov
arkadylukashov / numberend.js
Last active April 20, 2018 10:09
Number ending
function numberEnd(n, titles) {
var cases = [2, 0, 1, 1, 1, 2];
return titles[(n % 100 > 4 && n % 100 < 20) ? 2 : cases[Math.min(n % 10, 5)]];
}
@arkadylukashov
arkadylukashov / Fixed footer
Last active August 29, 2015 14:14
Fixed footer
@arkadylukashov
arkadylukashov / pinnize.js
Last active December 21, 2015 00:09
Simple plugin that transform your inline-blocked item layout into a pinterest-like grid
/**
* Plugin that transform ur inline-blocked grid into a
* pinterest-like grid :)
* @author arkadylukashov
* @link https://gist.github.com/arkadylukashov/6218172
*/
;(function ($) {
$.fn.pinnize = function(options) {
@arkadylukashov
arkadylukashov / jquery.preload.piecon.js
Created January 21, 2013 14:39
Simple image preloader uses jQuery and Piecon
/* piecon */
(function(){var i={},j=null,k=null,f=null,g=null,h={},l={color:"#ff0084",background:"#bbb",shadow:"#fff",fallback:!1},c,o=navigator.userAgent.toLowerCase();c=function(e){return-1!==o.indexOf(e)};var p=c("msie");c("chrome");c("chrome")||c("safari");var q=c("safari")&&!c("chrome");c("mozilla")&&!c("chrome")&&c("safari");var m=function(e){for(var a=document.getElementsByTagName("link"),c=document.getElementsByTagName("head")[0],f=0,h=a.length;f<h;f++)("icon"===a[f].getAttribute("rel")||"shortcut icon"===
a[f].getAttribute("rel"))&&c.removeChild(a[f]);a=document.createElement("link");a.type="image/x-icon";a.rel="icon";a.href=e;document.getElementsByTagName("head")[0].appendChild(a)},n=function(){g||(g=document.createElement("canvas"),g.width=16,g.height=16);return g};i.setOptions=function(e){h={};for(var a in l)h[a]=e.hasOwnProperty(a)?e[a]:l[a];return this};i.setProgress=function(e){f||(f=document.title);if(!k||!j){var a;a:{a=document.getElementsByTagName("link");for(var c=0,i=a.length;c<i;c++)if("i
/**
* Provides requestAnimationFrame in a cross browser way.
* @author paulirish / http://paulirish.com/
*/
if ( !window.requestAnimationFrame ) {
window.requestAnimationFrame = ( function() {
return window.webkitRequestAnimationFrame ||
@arkadylukashov
arkadylukashov / jquery.preload.js
Created December 19, 2012 09:45
Simple image preloader uses jQuery
(function($) {
$.fn.preload = function(forPreload, options) {
var settings = $.extend({
debug : false,
percentage : {
textCnt : '',
lineCnt : ''
},
@arkadylukashov
arkadylukashov / jquery.fullscreen.js
Created December 19, 2012 04:01
Simple jQuery element based Fullscreen API wrapper
(function($) {
$.fn.fullscreen = function(options) {
var settings = $.extend({
to: false,
exit: 'Normal size',
onScreenChange: $.noop,
onFail: $.noop
},options);