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
const myState = {
almafa: 'B'
};
const Foo = (props) => (
<div>Hello { props.belmafa }</div>
);
function myReducer(state = myState, action) {
switch (action.type) {
// Good
const Calendar = (props) => (
<div className="calendar" onClick={ props.handleClick }>
{ props.title }
</div>
);
// Good
@ruffle1986
ruffle1986 / remove-whitespaces.js
Created May 13, 2016 12:32
Remove whitespaces with regexp
str.replace(/\s/g, '');
@ruffle1986
ruffle1986 / apply-box-sizing.css
Created April 29, 2016 12:36
Apply box-sizing
*,
*:before,
*:after{
box-sizing: border-box;
}
@ruffle1986
ruffle1986 / grid.less
Created April 7, 2016 07:41
semantic grid system for less
/////////////////
// Semantic.gs // for LESS: http://lesscss.org/
/////////////////
// Defaults which you can freely override
@column-width: 60;
@gutter-width: 20;
@columns: 12;
// Utility variable — you should never need to modify this
url.replace(/^.*?:\/\//, '')
@ruffle1986
ruffle1986 / index.html
Created March 17, 2016 13:47
basic html 5 page
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Document</title>
</head>
<body>
</body>
</html>
@ruffle1986
ruffle1986 / create-document.js
Created February 5, 2016 13:40
Code snippet to create browser-like environment with jsdom for integration tests.
import { jsdom } from 'jsdom';
const document = jsdom('<html><body><div id="root"></div></body></html>');
const window = document.defaultView;
global.document = document;
global.window = window;
global.navigator = window.navigator;
@ruffle1986
ruffle1986 / szorgalmi.js
Created November 15, 2015 17:16
balint szorgalmi
var competitors = require('./competitors.json');
if (!Array.isArray(competitors)) {
console.log('Hiba: az átadott elem típusának tömbnek kell lennie.');
}
competitors
.sort(function (a, b) {
return b.points - a.points;
})
@ruffle1986
ruffle1986 / redux-reducer-immutability-test.js
Created September 24, 2015 15:50
redux reducer immutability test
import test from 'ava';
import * as actionTypes from './your-action-types';
import reducer from './your-reducer';
import deepEqual from 'deep-equal';
test('reducer:immutability test', t => {
const dummy = {};
for (const action in actionTypes) {
if (actionTypes.hasOwnProperty(action)) {
const result = reducer(dummy, {type: actionTypes[action]});