Skip to content

Instantly share code, notes, and snippets.

View voznik's full-sized avatar
🤔
Open for opportunities

Vadym Parakonnyi voznik

🤔
Open for opportunities
View GitHub Profile
{
"autocomplete": true,
"autoimport": true,
"enable_auto_align": false,
"format_on_save": true,
"ignore": "Parent",
"indent_with_space": 4,
"passes":
[
"ReindentSwitchBlocks",

Multi-site setup (false)

"Or why have 30 admin panels when one would probably suffice," for people with way too many sites.

The base idea is to achieve a multi-site setup that is both more flexible and simpler than native Grav multi-site handling. One major advantage of such a setup is it makes it feasible to have completely different URLs for the different sites.

The strategy used to achieve this uses a combination of (hard) symbolic links, theme-layer taxonomy filtering and homepage configuration for each site.

Folder structure

  • public_html - Web folder on your server.
    • pages symlinked - Present outside of the Grav installations for convenient access without having to rely on admin interface.
@voznik
voznik / init.coffee
Last active April 25, 2018 09:15
voznik's atom settings
# Made with ♥ for a healthy Atom.
# Avoid copy empty lines.
# https://discuss.atom.io/t/resolved-avoid-copying-when-selection-is-empty/
atom.commands.add 'atom-text-editor', 'core:copy', (e) ->
editor = e.currentTarget.getModel()
return if editor.getSelectedBufferRanges().length > 1
{start, end} = editor.getSelectedBufferRange()
if start.column is end.column and start.row is end.row
e.stopImmediatePropagation()
@voznik
voznik / README.md
Created September 21, 2016 09:07 — forked from felippenardi/README.md

Testing an Angular $resource factory

This is an example of how to test an Angular Resource created with $resource.

Live Demo

Important take aways:

  • Do not mock $resource. Instead, you can use the resource's methods and assert that it is making the right API call. By doing that you can later change the implementation (for example for replace $resource for Angular Cached Resource) without needing toi go change all previous tests.
  • When intercepting the response of a custom method, do not transform the response string into json yourself. When you use the transformResponse action property of a $resource, you replace the default angular parser that is transforming backend response from string to JSON. It has some logic to ensure that the response is a JSON and can be parsed securely. You can use it by injecting $http into your factory and using `$http.defaults.transformRespon
@voznik
voznik / config.cson
Created September 4, 2016 10:24
Solirized Dark for terminal-fusion Atom Terminal (fork of platformio-atom-ide-terminal)
"platformio-ide-terminal":
ansiColors:
normal:
black:
red: 88
green: 110
blue: 117
alpha: 1
blue:
red: 38
@voznik
voznik / angular-loading-bar_overlay.css
Created March 23, 2016 14:55
angular-loading-bar overlay
#loading-bar {
pointer-events: all;
z-index: 99999;
border: none;
margin: 0px;
padding: 0px;
width: 100%;
height: 100%;
top: 0px;
left: 0px;
# via http://wiki.apache.org/couchdb/Installing_on_Ubuntu

sudo apt-get install --yes build-essential curl git
sudo apt-get install --yes python-software-properties python g++ make

sudo apt-get install -y erlang-dev erlang-manpages erlang-base-hipe erlang-eunit erlang-nox erlang-xmerl erlang-inets
sudo apt-get install -y libmozjs185-dev libicu-dev libcurl4-gnutls-dev libtool

# via http://ftp.fau.de/apache/couchdb/source/1.6.1/

cd /tmp

@voznik
voznik / Angular.Ionic.HardwareBackButtonManager.js
Created October 29, 2015 09:55 — forked from mircobabini/Angular.Ionic.HardwareBackButtonManager.js
HardwareBackButtonManager Service for Ionic (Angular.js) provides an interface to easily enable or disable the hardware back button on Android
.service( 'HardwareBackButtonManager', function($ionicPlatform){
this.deregister = undefined;
this.disable = function(){
this.deregister = $ionicPlatform.registerBackButtonAction(function(e){
e.preventDefault();
return false;
}, 101);
}
@directive = angular.module('ui-commons.autosave', [])
@directive.directive 'autosave', ['formHandler', 'promiseTrackers', '$timeout', (formHandler, promiseTrackers, $timeout) ->
restrict: 'A'
require: ['form', 'autosave']
controller: ($scope) ->
submitExpr = null
tracker = null
currentPromise = null
formDelay = null