Skip to content

Instantly share code, notes, and snippets.

View JiLiZART's full-sized avatar
💭
I may be slow to respond.

Nikolay Kost JiLiZART

💭
I may be slow to respond.
View GitHub Profile
const If = (cond) => (truly) => (falsy) => [truly, falsy][!cond + 0]()
const result = If(false)(() => 'true')(() => 'false')
@JiLiZART
JiLiZART / function_invocation.js
Created June 18, 2017 20:17 — forked from myshov/function_invocation.js
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);
@JiLiZART
JiLiZART / isStringBalanced.js
Created August 7, 2017 21:12
Проверка валидности скобок ( и [
const isB = (str) => {
const strArr = str.split('');
const stack = [];
for (let char of strArr) {
if (char.startsWith('[') || char.startsWith('(')) {
stack.push(char);
} else {
// Первый символ строки не открывающаяся скобка, значит уже не верно
/**
* Shortcut transform function for all supported browsers
* @param {String} transform
* @returns {jQuery}
*/
jQuery.fn.transform = function(transform) {
return this.css({
'-webkit-transform': transform, /* Chrome, Safari 3.1+ */
'-moz-transform': transform, /* Firefox 3.5-15 */
'-ms-transform': transform, /* IE 9 */
function shiftZeros(arr) {
var len = arr.length-1,
lastidx = len,
ZERO = 0;
for (var i = 0; i <= len; i++) {
if (lastidx <= i) break;
while (arr[lastidx] === ZERO) {
lastidx--;
(function(console){
console.save = function(data, filename){
if(!data) {
console.error('Console.save: No data')
return;
}
if(!filename) filename = 'console.json'
https://jquery.com/
https://nodejs.org/en/
https://angularjs.org/
https://angular.io/
https://cordova.apache.org/
https://electronjs.org/
https://reactjs.org/
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
var _class, _temp;
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
function _inherits(subClass, superClass)
// выполняем в консоли на сайте vk.com
(function(console){
console.save = function(data, filename){
if(!data) {
console.error('Console.save: No data')
return;
}
if(!filename) filename = 'console.json'

Принципы разработки Амплифера

Тут перечислены не законы, последние слово всегда за здравым смыслом. Тут перечислены лишь направление, куда надо стремиться. Принципы, которые должны помочь, когда не знаешь, что выбрать.

Ценности

  1. Пользователь. Если что-то сильно мешает UX или есть критическая ошибка, то в первую очередь мы спасаем пользователей. Для этого иногда надо взять ответственность на себя, переубедить толпу, написать плохой код.