Skip to content

Instantly share code, notes, and snippets.

View mikkpr's full-sized avatar

Mikk Pristavka mikkpr

View GitHub Profile
@mikkpr
mikkpr / keybase.md
Created October 6, 2017 09:45
keybase.md

Keybase proof

I hereby claim:

  • I am mikkpr on github.
  • I am mikkpr (https://keybase.io/mikkpr) on keybase.
  • I have a public key ASCtlvDpDxjE0vCAkzK-huYjlxx7ma8Wd7BkSpXMF7pLHgo

To claim this, I am signing this object:

@mikkpr
mikkpr / connectState.js
Created September 6, 2017 13:56
connectState that vaguely works like react-redux's `connect`
/* usage:
const dataSelector = state => {
return state.foo.bar;
}
connectState(dataSelector)((newValue, prevValue) => {
console.log('foo.bar changed from', prevValue, 'to', newValue);
});
*/
@mikkpr
mikkpr / README.md
Last active July 26, 2017 09:20
Lightbox for content area images
  1. Add both default skins and loader images to the site's template assets (find them in a comment below).
  2. Add photoswipe.js and photoswipe.css to the site's template assets. These already include the default skin assets and correct URLs.
  3. Create photoswipe component and include it on pages where content area images should open in a lightbox
@mikkpr
mikkpr / ding
Last active October 4, 2016 12:08
A slightly modified version of https://github.com/liviu-/ding (OS X only)
#!/usr/bin/env python
"""Simple CLI beep tool"""
from __future__ import unicode_literals
from __future__ import print_function
import os
import sys
import time
import datetime
@mikkpr
mikkpr / README.markdown
Last active June 16, 2017 15:12
Wordpress XML -> Voog articles

Migrating Wordpress articles to Voog

Requirements

  • Ruby (2.0 and newer)
  • gem install voog_api
  • gem install mime-types
  • gem install nokogiri

What to do?

  • Make sure you have enough free space to temporarily hold all the necessary image assets before re-uploading them to Voog
@mikkpr
mikkpr / pre-commit
Created August 31, 2016 12:07
Git pre-commit hook that automatically removes trailing whitespace
#!/bin/bash
#
# A git hook script to find and fix trailing whitespace
# in your commits. Bypass it with the --no-verify option
# to git-commit
#
# usage: make a soft link to this file, e.g., ln -s ~/config/pre-commit.git.sh ~/some_project/.git/hooks/pre-commit
# detect platform
@mikkpr
mikkpr / MobileMenuItem.tpl
Created November 10, 2014 07:48
Recursive menu rendering in Voog
<li class="{% if item.selected? %}open{% endif %}">
{% if item.selected_with_children? %}<div class="mobile-menu-arr"></div>{% endif %}
{% menulink item selected-class="active" %}
{% if item.selected_with_children? %}
<ul>
{% for item in item.visible_children %}
{% include "MobileMenuItem" with item %}
{% endfor %}
{% if editmode %}{% menuadd parent="item" %}{% endif %}
</ul>
@mikkpr
mikkpr / voog-api-session()
Last active August 29, 2015 14:06
ZSH function to start a Voog API session in the pry interpreter
# prerequisites:
# * installed gem 'voog_api'
# * ZSH
# * RBENV
# * existing ~/.voog file
# add to ~/.zshrc:
# returns the API token for the given Voog site
voog-token() {
require 'voog_api'
if ARGV
if ARGV[0]
SITE = ARGV[0]
else
SITE = 'voog.local'
end
if ARGV[1]