Skip to content

Instantly share code, notes, and snippets.

Sitian Liu goldensunliu

Block or report user

Report or block goldensunliu

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View puzzle.js
const puzzle = [
[cell, cell, cell, cell, cell, cell, cell, cell, cell],
[cell, cell, cell, cell, cell, cell, cell, cell, cell],
[cell, cell, cell, cell, cell, cell, cell, cell, cell],
[cell, cell, cell, cell, cell, cell, cell, cell, cell],
...
]
View inferFromSelected.js
getSelectedCell() {
const { board } = this.state
const selected = board.get('selected')
return selected && board.get('puzzle').getIn([selected.x,selected.y])
}
renderCell(cell, x, y) {
const { board } = this.state
const selected = this.getSelectedCell()
const sameValue = selected && selected.get('value') && value === selected.get('value')
View selectCell.js
class Game extends Compoent {
...
getSelectedCell() {
const { board } = this.state;
const selected = board.get('selected');
return selected && board.get('puzzle').getIn([selected.x, selected.y]);
}
selectCell = (x, y) => {
let { board } = this.state
View cell.js
const cell = {
value: 9,
notes: Set([1,2,3]),
prefilled: false
}
View Cell.js
const Cell = (props) => {
const {
value, onClick, isPeer, isSelected, sameValue, prefilled, notes, conflict,
} = props;
const backgroundColor = getBackGroundColor({
conflict, isPeer, sameValue, isSelected,
});
const fontColor = getFontColor({ conflict, prefilled, value });
return (
<div className="cell" onClick={onClick}>
View goodie.js
debugger
console.log(document.cookie)
View ConnectedArtist.js
import React, { Component } from 'react';
import { connect } from 'react-redux';
import { fetchAudioFeaturesById } from '../actions';
import Artist from '../Artist'
const mapStateToProps = ...
const mapDispatchToProps = ...
class ConnectedArtist extends React.Component {
...
View ConnectedAudioFeatures.js
import React, { Component } from 'react';
import { connect } from 'react-redux';
import { fetchAudioFeaturesById } from '../actions';
// stateless template for the display
import AudioFeatures from '../AudioFeatures'
const mapStateToProps = ({audioFeaturesById}, {trackId}) => ({
audioFeatures: audioFeaturesById[trackId]
});
View PlayHistoryPage1.0.js
import React, { Component } from 'react';
import { connect } from 'react-redux';
import withRedux from '../nextWithReduxWrapper';
import { FETCH_PLAY_HISTORY } from '../actions';
import PlayHistory from '../components/PlayHistory';
const mapStateToProps = ({ history, artistsById, audioFeaturesById }) => {
return { history, artistsById, audioFeaturesById };
};
View clean_output.css
.page_title {
color: #212121;
font-size: 36px;
}
.page_cta {
color: #616161;
font-size: 18px;
}
You can’t perform that action at this time.