Skip to content

Instantly share code, notes, and snippets.

View eyaleizenberg's full-sized avatar

Eyal Eizenberg eyaleizenberg

View GitHub Profile
'use strict'
React = require('react-native')
NavigationBarRouteMapper = require('../modules/navigation_bar_route_mapper')
_ = require('lodash')
pages =
Incidents: Incidents
Notifications: Notifications
@eyaleizenberg
eyaleizenberg / root_reducer.js
Last active March 20, 2018 06:17
Initializing Redux Cornell
import { combineReducers } from 'redux';
import reduxCornell from 'redux-cornell';
const { selectors, actions, superReducer } = reduxCornell({
initialState: {
episodes: {
loaded: false,
data: [],
expanded: {}
},
@eyaleizenberg
eyaleizenberg / appContainer_selectors.js
Last active January 22, 2018 08:28
App container for Redux Cornell
import { connect } from 'react-redux'
import { selectors } from '../redux/reducers';
import App from '../components/App/App';
const mapStateToProps = (state) => ({
showInfoVisible: selectors.getShowInfoVisible(state)
});
export default connect(mapStateToProps)(App);
@eyaleizenberg
eyaleizenberg / app_container_with_action.js
Last active January 22, 2018 08:27
app container with actions
import { connect } from 'react-redux'
import { selectors, actions } from '../redux/reducers';
import App from '../components/App/App';
const mapStateToProps = (state) => ({
showInfoVisible: selectors.getShowInfoVisible(state)
});
const { toggleShowInfoVisible } = actions;
@eyaleizenberg
eyaleizenberg / episodesActions.js
Created January 22, 2018 08:36
imdb_list actions
import * as imdb from 'imdb-api';
import { actions } from '../redux/reducers';
const showId = 'tt4574334';
const apiKey = 'your_omdb_api_key_goes_here';
export const fetchStrangerThings = () => (dispatch) => {
imdb.getById(showId, { apiKey }).then(results => {
results.episodes().then(episodes => {
dispatch(actions.concatEpisodesData(episodes));
@eyaleizenberg
eyaleizenberg / app_container.js
Created January 22, 2018 08:42
imdb_list final app container
import * as React from 'react';
import { connect } from 'react-redux'
import App from '../components/App/App';
import { selectors, actions } from '../redux/reducers';
import { fetchStrangerThings } from '../actions/episodesActions';
import PropTypes from 'prop-types';
export class AppContainer extends React.PureComponent {
static propTypes = {
showInfoVisible: PropTypes.bool.isRequired,
@eyaleizenberg
eyaleizenberg / episodes_length_selector.js
Created January 22, 2018 08:52
imdb_list custom selector
export const getEpisodesDataLength = (state) => state.superReducer.episodes.data.length;

The Doom (stylized as DOOM) franchise is a series of first-person shooter video games developed by id Software. The series focuses on the exploits of an unnamed space marine operating under the auspices of Union Aerospace Corporation (UAC), who fights hordes of demons and the undead in order to survive.

The objective of the game is to clear a rectangular board containing hidden "mines" or bombs without detonating any of them, with help from clues about the number of neighboring mines in each field.

This game is a hybrid of both of these games. The gameplay of Minesweeper and the theme of DOOM.

The game is built using React, Redux and Typescript.

Here is the code which 'conjures' the 'demons' (mines) on the game matrix. It will loop until all demons have been set in the game:

is_hebrew="$(defaults read ~/Library/Preferences/com.apple.HIToolbox.plist AppleSelectedInputSources)"
lang="EN"
if [[ $is_hebrew = *"Hebrew"* ]]; then
lang="HE"
fi
tm_segment "" "colour243" "$lang"
tm_divider
@eyaleizenberg
eyaleizenberg / state_in_constructor.tsx
Last active June 29, 2018 06:31
state in constructor
interface IProps {
superhero: string;
}
interface IState {
health: number;
}
export class MyComponent extends React.PureComponent<IProps, IState> {
constructor(props: IProps) {