Skip to content

Instantly share code, notes, and snippets.

View weslleyaraujo's full-sized avatar
💤

Weslley Araujo weslleyaraujo

💤
View GitHub Profile
const lightenPad = createAction(LIGHTEN_PAD);
const lightenOffPad = createAction(LIGHTEN_OFF_PAD);
lightenPad({ id: 'green' }); // { type: 'LIGHTEN_PAD', payload: { id: 'green' } };
lightenOffPad(); // { type: 'LIGHTEN_OFF_PAD', payload: {} };
function pads(state, action) {
const { type, payload } = action;
switch(type) {
case LIGHTEN_PAD:
import React, { Component } from 'react';
import audios from '../audios';
import { connect } from 'react-redux';
export class Player extends Component {
componentDidUpdate() {
const { active } = this.props;
const player = this.refs[active];
if (!player) {
{
 pads: [
{
id: ‘green’,
component: ‘GreenPad’,
active: false
},
// More pads here
 ],
 game: {
import styled from ‘styled-components’;
const Score = styled.div`
 /* some styles here … */
 font-size: ${props => props.length <= 2 ? 62 : 45}px;
`;
import color from ‘color’; // a simple color helper library
import styled from ‘styled-components’;
const lighten = from => color(from).lighten(0.333).hexString();
const activeCSS = props => `
 background-color: ${lighten(props.color)} !important;
`;
export const Pad = styled.div`
 /* some styles here … */
${(props) => props.active ? activeCSS(props) : ‘’}

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname
git log --first-parent --pretty=format:'%s' \
| grep -v '^update changelog' \
| perl -p -e 's/^((v?[0-9]+\.?)+)$/\n## \1\n/g' \
| perl -p -e 's/^([^#\s].*)$/* \1/g'
const crashReporter = store => next => action => {
try {
return next(action)
} catch (err) {
console.error('Caught an exception!', err)
// capture error somehow here: action, store.getState()
throw err;
}
}
@weslleyaraujo
weslleyaraujo / iffy.js
Last active February 18, 2016 11:56
add behavior on input's based on values
(function (root, factory) {
if (typeof define === 'function' && define.amd) {
define(['jquery'], factory);
} else if (typeof exports === 'object') {
module.exports = factory(require('jquery'));
} else {
root.Iffy = factory(root.$);
}
{
"private": true,
"scripts": {
"build:js": "browserify -e source/scripts/index.js -t [ babelify --optional es7 ] -o public/bundle.js",
"build:css": "cssnext source/styles/index.css public/bundle.css",
"build": "npm run js && npm run css",
"watch:js": "watchy -w source/scripts -- npm run build:js",
"watch:css": "watchy -w source/styles -- npm run build:css"
},
"dependencies": {},