Skip to content

Instantly share code, notes, and snippets.

View valerybugakov's full-sized avatar
✌️

Valery Bugakov valerybugakov

✌️
View GitHub Profile

AngularJS Directive Attribute Binding Explanation

When using directives, you often need to pass parameters to the directive. This can be done in several ways. The first 3 can be used whether scope is true or false. This is still a WIP, so validate for yourself.

  1. Raw Attribute Strings

    <div my-directive="some string" another-param="another string"></div>
@valerybugakov
valerybugakov / Git push deployment in 7 easy steps.md
Created March 31, 2016 05:17 — forked from thomasfr/Git push deployment in 7 easy steps.md
7 easy steps to automated git push deployments. With small and configurable bash only post-receive hook
@valerybugakov
valerybugakov / jsformatter.vim
Last active July 29, 2017 00:56
Vim-airline-tabline formatter
" Drop this file into ~/.vim_bundle/vim-airline/autoload/airline/extensions/tabline/formatters
" And add to your .vimrc:
" :let g:airline#extensions#tabline#formatter = 'jsformatter'
function! airline#extensions#tabline#formatters#jsformatter#format(bufnr, buffers)
let buf = bufname(a:bufnr)
let filename = fnamemodify(buf, ':t')
if filename == 'index.js' || filename == 'index.jsx'
return fnamemodify(buf, ':p:h:t') . '/i'
@valerybugakov
valerybugakov / anagram.js
Last active July 20, 2016 11:47
Anagram checker
function getAnagrams(words) {
const normalize = word => word.toLowerCase().split('').sort().join('').trim()
const map = {}
let n = 0
const anagrams = words.reduce((res, word, i) => {
const normalized = normalize(word)
if (typeof map[normalized] === 'number') {
res[map[normalized]].push(word)