Skip to content

Instantly share code, notes, and snippets.

View denysdovhan's full-sized avatar
👨‍💻
Working for @wix

Denys Dovhan denysdovhan

👨‍💻
Working for @wix
View GitHub Profile
@denysdovhan
denysdovhan / gist:0080d1bdcf5a43d19265e3b7225618f1
Created September 13, 2016 20:58 — forked from aqualungdesign/gist:4612606
iterm / oh-my-zsh -> rm move to .trash
#add script to .oh-my-zsh/lib/functions.zsh
function rm () {
local path
for path in "$@"; do
# ignore any arguments
if [[ "$path" = -* ]]; then :
else
local dst=${path##*/}
# append the time if necessary
@denysdovhan
denysdovhan / package.json
Created June 2, 2016 14:51
shell scripts
{
"scripts": {
"build": "./scripts/build",
"test": "./scripts/test"
}
}
@denysdovhan
denysdovhan / package.json
Created June 2, 2016 14:38
better-npm-run
{
"devDependencies": {
"better-npm-run": "~0.0.1"
},
"scripts": {
"build:dist": "better-npm-run build:dist",
"test": "better-npm-run test"
},
"betterScripts": {
"build:dist": {
@denysdovhan
denysdovhan / package.json
Last active June 2, 2016 14:08
How do you organize your npm-scripts?
{
"...": "...",
"scripts": {
"...": "...",
"build": "cross-env NODE_ENV=production webpack --config internals/webpack/webpack.prod.babel.js --color -p",
"test": "cross-env NODE_ENV=test karma start internals/testing/karma.conf.js --single-run",
"test-node": "./node_modules/mocha/bin/mocha $(find api -name '*-test.js') --compilers js:babel-core/register",
"...": "..."
},
"...": "..."
@denysdovhan
denysdovhan / file.js
Last active March 26, 2016 15:08
JS Functions Container
console.log('This is test.js');
console.log(scope.passed);
@denysdovhan
denysdovhan / pr.md
Created March 13, 2016 12:33 — forked from piscisaureus/pr.md
Checkout github pull requests locally

Locate the section for your github remote in the .git/config file. It looks like this:

[remote "origin"]
	fetch = +refs/heads/*:refs/remotes/origin/*
	url = [email protected]:joyent/node.git

Now add the line fetch = +refs/pull/*/head:refs/remotes/origin/pr/* to this section. Obviously, change the github url to match your project's URL. It ends up looking like this:

@denysdovhan
denysdovhan / battery.zsh
Created February 1, 2016 09:31
ZSH Battery Prompt
###################################
# .zsh/functions/battery_percent
###################################
LAST_FULL_CAP=$(grep -h "last full capacity" /proc/acpi/battery/BAT?/*| sed 's/[^0-9]//g')
REMANING_CAP=$(grep -h "remaining capacity" /proc/acpi/battery/BAT?/*| sed 's/[^0-9]//g')
BATTERY_CHARGING=$(grep -h "charging state:" /proc/acpi/battery/BAT?/state|sed 's/.*:\s*//')
BATTERY_PERCENT=$((($REMANING_CAP*100)/$LAST_FULL_CAP))
if [[ "${BATTERY_PERCENT}" -lt 15 ]]; then

@-правила CSS

Переклад статті Джеффа Грема на CSS-Tricks від 12 травня 2015.

@-правила це оператори, що вказують CSS на інструкції щодо виконання та поводження. Кожен оператор починається символом @, що слідує перед одним із доступних ключових слів, які є ідентифікаторами того, що CSS слід робити. Такий загальний синтаксис, хоча кожне @-правило має свої варіації.

Регулярні правила

Регулярними є правила, які відповідають наступному синтаксису:

// Парсер Less вміє виконувати JavaScript-код, що зберігається в змінних.
// Тут невеликий приклад, як можна поєднувати less та js.
// Якийсь колір від балди, щоб продемонструвати інтерполяцію
@color: #dead00;
// Ще для одного прикладу інтерполяції
@foo: 10;
@denysdovhan
denysdovhan / sh_stats.sh
Last active August 29, 2015 14:21 — forked from A/sh_stats.sh
sh_stats () {
fc -l 1 | awk '{CMD[$2]++;count++;}END { for (a in CMD)print CMD[a] " " CMD[a]/count*100 "% " a;}' | grep -v "./" | column -c3 -s " " -t | sort -nr | nl | head -n20
}