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 redo.js
class Game extends Compoent {
...
redo = () => {
const { history } = this.state;
let { historyOffSet } = this.state;
if (history.size) {
historyOffSet = Math.min(history.size - 1, historyOffSet + 1);
const board = history.get(historyOffSet);
this.setState({ board, historyOffSet });
}
View NumberControl.js
const NumberControl = ({ number, onClick, completionPercentage }) => (
<div
key={number}
className="number"
onClick={onClick}
>
<div>{number}</div>
<CirclularProgress percent={completionPercentage} />
<style jsx>{NumberControlStyle}</style>
</div>
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 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 goodie.js
debugger
console.log(document.cookie)
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 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]
});
You can’t perform that action at this time.