Skip to content

Instantly share code, notes, and snippets.

View Restuta's full-sized avatar
🦄
Hacking fast and slow.

Anton Vynogradenko Restuta

🦄
Hacking fast and slow.
View GitHub Profile
<!DOCTYPE html>
<meta charset="utf-8">
<link rel="stylesheet" href="http://cmx.io/v/0.1/cmx.css"/>
<script src="http://cmx.io/v/0.1/cmx.js"></script>
<body>
<scene id="scene1">
<label t="translate(0,346)">
<tspan x="0" y="0em">Half as Russian</tspan>
</label>
<actor t="translate(85,60)" pose="-11,9|-5,117|-11,99|-11,89|-11,79|-11,59|-16,34|-21,9|-6,34|-1,9|-18,79|-18,59|-6,79|-1,59">
@Restuta
Restuta / the-bind-problem.jsx
Last active August 13, 2026 06:49
React, removeEventListener and bind(this) gotcha
/* Sometimes it's pretty easy to run ito troubles with React ES6 components.
Consider the following code: */
class EventStub extends Component {
componentDidMount() {
window.addEventListener('resize', this.onResize.bind(this)); //notice .bind
}
componentWillUnmount() {
window.removeEventListener('resize', this.onResize.bind(this));
@Restuta
Restuta / gist:1fb558d0b21ae30ac60f
Last active December 16, 2015 00:00
Teleportations feedback
Hi everyone, I wanted to highlight couple of moments regarding past event. First of all let me explain that my intent is not to blame organizers (while it may appear like it is), I am thankful for their initiative. I fully support popularization of science and respect what they are doing.
But.
I want to point out that event description is somewhat "advetisery" (yes it's not even a word) meaning it contains several inaccuracies, making you think that it's a sensation while it is not. E.g. here is debunking of the event description I made after attending the event:
http://content.screencast.com/users/Restuta/folders/Jing/media/8dabb964-0a0c-4411-a1ba-08015a18a7b2/00000668.png
While I understand that sound headlines, hidden assumptions and other marketing tricks attract more people, at the same time they put off other category of people who are a little deeper into the topic.

Ver.1 (for survey)

The only personal information we collect in this survey is your age, sex and email address. All information you provide is kept in strict confidence and will never be sold or given to a third party for any reason. We collect your email address in order to send you survey results or product release. If there are any questions regarding this privacy policy you may contact us: r@rcn.io

Ver.2

Your privacy is important to us, and it is RCN's policy to respect your privacy regarding any information we may collect while operating our websites. Accordingly, we have developed this Policy in order for you to understand how we collect, use, communicate and disclose and make use of personal information. The following outlines our privacy policy.

Before or at the time of collecting personal information, we will identify the purposes for which information is being collected. We will collect and use of personal information solely with the objective of fulfilling those purposes specified by us and for

@Restuta
Restuta / HOC.js
Last active May 26, 2024 20:01
React HOC (Higher Order Component) Example
/* HOC fundamentally is just a function that accepts a Component and returns a Component:
(component) => {return componentOnSteroids; } or just component => componentOnSteroids;
Let's assume we want to wrap our components in another component that is used for debugging purposes,
it just wraps them in a DIV with "debug class on it".
Below ComponentToDebug is a React component.
*/
//HOC using Class
//it's a function that accepts ComponentToDebug and implicitly returns a Class
let DebugComponent = ComponentToDebug => class extends Component {
@Restuta
Restuta / 2016-race-plan.md
Last active January 26, 2016 00:56
2016 race plan for Rob
Legend
CR - Circuit Race
RR - Road Race
TT - Time Trial
CT - Criterium

e.g. (B)(CR)(2x1h) = B event, Circuit Race, two fields x 1h each

@Restuta
Restuta / export.js
Last active June 9, 2017 21:00
Babel Interop Defaults might lead to confusion with ES6 Modules and imports/exports
//define module-a.js
export default { x: 8 }
//then in module-b.js
import {x} from './module-a';
console.log(x);
// ^^^ outputs 8 with default Babel settings while according to ES6 spec should output "undefined"
//this is explained by the following quote:
/* In order to encourage the use of CommonJS and ES6 modules, when exporting a default export with no other exports
@Restuta
Restuta / slim-redux.js
Created September 24, 2015 02:39 — forked from gaearon/slim-redux.js
Redux without the sanity checks in a single file. Don't use this, use normal Redux. :-)
function mapValues(obj, fn) {
return Object.keys(obj).reduce((result, key) => {
result[key] = fn(obj[key], key);
return result;
}, {});
}
function pick(obj, fn) {
return Object.keys(obj).reduce((result, key) => {
if (fn(obj[key])) {
@Restuta
Restuta / Bootstrap Grid Visualized.markdown
Created September 10, 2015 21:49
Bootstrap Grid Visualized
@Restuta
Restuta / arrow-fu-and-this.js
Created September 8, 2015 19:26
Arrow functions and "this"
function Foo() {
setTimeout(
function() { console.log(this); },
200);
}
function Bar() {
setTimeout(
() => { console.log(this); },
200);