Skip to content

Instantly share code, notes, and snippets.

View DKunin's full-sized avatar
🎯
Focusing

Dmitri Kunin DKunin

🎯
Focusing
View GitHub Profile
@flpvsk
flpvsk / index.md
Last active September 18, 2018 10:31
"Polyrhythmic animations" lightning talk proposal for ReactiveConf 2018

Polyrhythmic animations

Everything is Rhythm.

  • Air pulsating 440 times per second is note A 🎵
  • Electromagnetic field oscilating 440 trillion times per second is color red 🔴
  • Kick-drum beating 120 times per minute is your friend from Berlin listening to their favorite techno 🔊

We also know for a fact that Javascript is Everything.

@myshov
myshov / function_invocation.js
Last active January 21, 2024 15:14
11 Ways to Invoke a Function
console.log(1);
(_ => console.log(2))();
eval('console.log(3);');
console.log.call(null, 4);
console.log.apply(null, [5]);
new Function('console.log(6)')();
Reflect.apply(console.log, null, [7])
Reflect.construct(function(){console.log(8)}, []);
Function.prototype.apply.call(console.log, null, [9]);
Function.prototype.call.call(console.log, null, 10);
@dahjelle
dahjelle / pre-commit.sh
Created July 13, 2016 16:48
Pre-commit hook for eslint, linting *only* staged changes.
#!/bin/bash
for file in $(git diff --cached --name-only | grep -E '\.(js|jsx)$')
do
git show ":$file" | node_modules/.bin/eslint --stdin --stdin-filename "$file" # we only want to lint the staged changes, not any un-staged changes
if [ $? -ne 0 ]; then
echo "ESLint failed on staged file '$file'. Please check your code and try again. You can run ESLint manually via npm run eslint."
exit 1 # exit with failure status
fi
done
anonymous
anonymous / zsh-git-info.zsh
Created February 14, 2016 18:24
Provide git repository info in a configurable format
# # Provide git repository info in a configurable format
#
# All information is collected by a single git command and parsed in pure zsh
# with no external tools (sed, grep, cut, etc).
#
#
# ## What it looks like
#
# #1+2-3↪4&5 ↑6↓7 ⚡8 master
# | | | | | | | | |

Tutorial to ramda-cli, a jq-like JSON processor for command-line

In this tutorial we'll use ramda-cli with [GitHub's Repos API][gh-repos-api] to get a list of @jeresig's most starred repos.

[ramda-cli][ramda-cli] is a command-line tool for processing JSON using functional pipelines. As the name suggests, its utility comes from [Ramda][ramda] and [the wide array of functions][ramda-docs] it provides for operating on lists and collections of objects. It also employs

@nolanlawson
nolanlawson / protips.js
Last active February 4, 2024 18:06
Promise protips - stuff I wish I had known when I started with Promises
// Promise.all is good for executing many promises at once
Promise.all([
promise1,
promise2
]);
// Promise.resolve is good for wrapping synchronous code
Promise.resolve().then(function () {
if (somethingIsNotRight()) {
throw new Error("I will be rejected asynchronously!");
@yoavniran
yoavniran / ultimate-ut-cheat-sheet.md
Last active May 28, 2024 01:54
The Ultimate Unit Testing Cheat-sheet For Mocha, Chai, Sinon, and Jest
@gorborukov
gorborukov / russia
Created April 16, 2015 01:43
Регионы и города россии в формате JSON
[
{
"region": "Москва и Московская обл.",
"city": "Москва"
},
{
"region": "Москва и Московская обл.",
"city": "Абрамцево"
},
@DKunin
DKunin / .jshintrc
Created February 10, 2015 07:32
.jshintrc
{
"maxerr" : 15,
"newcap": false,
"browser": true,
"curly": true,
"freeze": true,
"indent": 4,
"esnext": true,
"globals": {
"module": true,