Skip to content

Instantly share code, notes, and snippets.

View ruffle1986's full-sized avatar
๐Ÿ––
live long

Tamas Fodor ruffle1986

๐Ÿ––
live long
View GitHub Profile
import React from 'react';
class MyComponent extends React.Component {
handleClick() {
const { data } = this.state;
this.setState({
data: data + 1
});
}
render() {
return (
[1,2,3].map(parseInt);
function b() {
return 1;
}
function c() {
var a = false;
return a || b();
}
function b() {
return false;
}
function c() {
var a = true;
return a && b();
}
@ruffle1986
ruffle1986 / react-test.js
Last active October 18, 2017 16:01
This program intends to increase the number of `1`s in an array and display the actual length of it in the buttons label. Does this code work as expected? If not, why?
import React from 'react';
class MyComponent extends React.Component {
state = {
data: []
}
handleClick = () => {
const data = this.state.data;
data.push(1);
@ruffle1986
ruffle1986 / magic.js
Last active September 15, 2017 09:16
Magic script to test the loader on the research site
function magic() {
var script = document.createElement('script');
script.src = 'http://127.0.0.1:8080/loader.js';
document.body.appendChild(script);
}
magic();
&:before {
content: "";
position: absolute;
bottom: -20px;
left: 40px;
border-width: 20px 20px 0;
border-style: solid;
border-color: #000 transparent;
display: block;
width: 0;
@ruffle1986
ruffle1986 / ymca.js
Last active December 1, 2016 15:22
YMCA actions, reducers, selectors
type Dispatch = (action: Action | ThunkAction) => any;
type GetState = () => Object;
type ThunkAction = (dispatch: Dispatch, getState: GetState) => any;
type Image = {
publicId: string,
tags: Array<string>
// ...
};
// actions
@ruffle1986
ruffle1986 / react-15.html
Created July 26, 2016 18:43
React quick starter pack
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Document</title>
<script src="https://cdnjs.cloudflare.com/ajax/libs/react/15.2.1/react.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/react/15.2.1/react-dom.min.js"></script>
</head>
<body>
@ruffle1986
ruffle1986 / pair-programming-with-csanad.js
Created June 21, 2016 14:09
Sample code of our pair programming session with Csanad
const CardStatusGroup = ({ label = '', items = [] }) => {
var arrayOfCardElements = items.map((item, i) => (
<CardElement key={ `card-element${i}` } { ...item } meta={ item.description } />
))
return (
<div className="card-status-group">
{ arrayOfCardElements }
</div>