Skip to content

Instantly share code, notes, and snippets.

View taxigy's full-sized avatar
🦆
flap flap flap flap

Rishat taxigy

🦆
flap flap flap flap
View GitHub Profile
@taxigy
taxigy / out.css
Created July 12, 2017 22:15
BEM 101 — out
// Block "button"
.button {
padding: 1em;
background-color: black;
}
// Block "button" -> element "label"
.button__label {
color: white;
}
@taxigy
taxigy / bad-class-names-mix-pattern.scss
Last active November 25, 2018 22:54
Red flag in CSS stylesheet design
// Okay
.button {
background-color: black;
}
// Okay
.label {
background-color: white;
}
@taxigy
taxigy / in.scss
Last active July 12, 2017 22:15
BEM 101 — in
// Block "button"
.button {
padding: 1em;
background-color: black;
// Element "label"
&__label {
color: white;
// Modifier "big"
@taxigy
taxigy / README.md
Last active June 26, 2017 19:44
Boyd

Boyd's Law of Iteration

Colonel John Boyd was interested not just in any dogfights, but specifically in dogfights between MiG-15s and F-86s. As an ex-pilot and accomplished aircraft designer, Boyd knew both planes very well. He knew the MiG-15 was a better aircraft than the F-86. The MiG-15 could climb faster than the F-86. The MiG-15 could turn faster than the F-86. The MiG-15 had better distance visibility.

The F-86 had two points in its favor. First, it had better side visibility. While the MiG-15 pilot could see further in front, the F-86 pilot could see slightly more on the sides. Second, the F-86 had a hydraulic flight control. The MiG-15 had a manual flight control.

The standing assumption on the part of airline designers was that maneuverability was the key component of winning dogfights. Clearly, the MiG-15, with its faster turning and climbing ability, could outmaneuver the F-86.

There was just one problem with all this. Even though the MiG-15 was considered a superior aircraft by airc

@taxigy
taxigy / index.js
Created May 23, 2017 15:23
Express won't match route with declared param when param is a zero-length string
const app = require('express')();
app.get('/:locale/(:slug|:version/:slug)', (req, res) => {
res.json(req.params);
});
app.listen(3001);
@taxigy
taxigy / first.md
Created April 28, 2017 14:25
Learning Clojure
layout title date categories crossposted
post
How I learned Clojure while solving easy coding challenges
2015-08-03
coding
logdown

I decided to learn Clojure (and therefore ClojureScript, since the two intersect significantly) by doing. Who'd ever blame me with that?

@taxigy
taxigy / styles.css
Created April 21, 2017 09:53
Variables in CSS styles
/* ONE: nested media query and calc */
:root {
--value: 30px;
}
.element {
border-radius: var(--value);
@media (min-width: 768px) {
border-radius: calc(var(--value) * 2);
@taxigy
taxigy / prettier.js
Created April 20, 2017 16:39
Prettier problem
// IN
const renderIndexPage = data => indexPage.replace('<!-- {{ data }} -->', `
<script>
window.CONTENTFUL_DATA = ${data};
</script>
`);
// OUT
const renderIndexPage = data =>
indexPage.replace(
@taxigy
taxigy / App.js
Created February 8, 2017 21:57
Refactoring of rows+columns
// Let's say that every new row is represented by an object with just two
// properties, "className" and "columns", with default values:
const EMPTY_ROW = {
columns: [{
className: 'col-md-12',
text: ''
}]
};
class App extends React.Component {
@taxigy
taxigy / flatten.js
Created June 20, 2016 22:08
Flatten an array with ES6 generators
const a = [[1,2,[3]],4];
function* flatten(e) {
const [first, ...rest] = e;
if (first instanceof Array && first.length) {
yield* flatten(first);
} else {
yield first;
}