This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"code.google.com/p/go-tour/tree" | |
"fmt" | |
"reflect" | |
) | |
// Walk walks the tree t sending all values | |
// from the tree to the channel ch. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{{deck}} | |
{{#each cards}} | |
{{#each brothers}} | |
{{> tmpl bro=this card=parentHelper deck=parentHelper.parentHelper.deck}} | |
{{/each}} | |
{{/each}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
set -e | |
FROM=/home/media/Downloads/complete | |
TO=/home/media/Video | |
for file in $FROM/*; do | |
echo "Where move file :$file" | |
select item in Shows Films Skip; do | |
case "$item" in |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- coding: utf-8 -*- | |
import re | |
def count_substrings_re(string, substring): | |
substring_re = '(?=(%s))' % re.escape(substring) | |
return len(re.findall(substring_re, string)) | |
def count_substrings(s, f): | |
ind = 1 | |
count = 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
for i in `env`; do | |
key=${i%=*} | |
[[ -z $short_env ]] && short_env=$key; | |
[[ ${#key} -lt ${#short_env} ]] && short_env=$key; | |
done | |
echo "Shortest env variable: $short_env" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
dist/libs.js: app/bower_components/lodash/lodash.min.js node_modules/react/dist/react.min.js node_modules/redux/dist/redux.min.js | |
cat $? > $@ | |
libs: dist/libs.js | |
.PHONY: libs |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[core] | |
autocrlf = true | |
mergeoptions = --no-ff | |
[user] | |
email = [email protected] | |
name = Alex Kalmakov | |
[help] | |
autocorrect = 1 | |
[alias] | |
# Shortcuts |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const findCellsInRadius = (w, h, center, radius) => { | |
let cellsInRadius = []; | |
let [centerX, centerY] = center; | |
_.range(w).forEach((x) => { | |
let rangeX = Math.abs(centerX - x); | |
(rangeX < radius) && _.range(h).forEach((y) => { | |
let rangeY = Math.abs(centerY - y); | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
# Фейковый npm | |
# Нужен для кэширования папки node_modules | |
# Кэш находится в папке ~/.cache/npm-inject/[sha1 хэш файла package.json]/node_modules | |
# | |
# В PATH надо добавить путь папки с фейковым npm, таким образом при выполнении команды `npm install` | |
# bash вызовет фейковый npm c параметром `install`. | |
# Фейк проверяет наличие папки [sha1 хэш файла package.json] в кэше. | |
# Если она в кэше, создаем на неё симлинк node_modules |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
version: '2' | |
- POSTGRES_PASSWORD=postgres | |
- POSTGRES_DB=postgres | |
ports: | |
- "5433:5433" | |
# Redis | |
redis: | |
image: redis:2.8.19 | |
hostname: redis |