Skip to content

Instantly share code, notes, and snippets.

View Eyongkevin's full-sized avatar
💭
Do something today your future self will thank you for.

Eyong Kevin Eyongkevin

💭
Do something today your future self will thank you for.
View GitHub Profile

MongoDB Cheat Sheet

Show All Databases

show dbs

Show Current Database

@Eyongkevin
Eyongkevin / dnd_containerMoveAction.js
Created August 7, 2020 19:57
sample code for the tut `Build a Shopping Cart with React, Redux, and React-DnD`
import React, { Component } from 'react';
import { DndProvider } from 'react-dnd';
import { HTML5Backend } from 'react-dnd-html5-backend';
import { connect } from 'react-redux'
import ShoppingCart from './ShoppingCart'
import MyCart from './MyCart'
import DisplayPhone from './DisplayPhone'
@Eyongkevin
Eyongkevin / dnd_shoppingCart.js
Created July 2, 2020 19:32
sample code for the tut `Build a Shopping Cart with React, Redux, and React-DnD`
class ShoppingCart extends Component{
render(){
const { canDrop, isOver, connectDropTarget } = this.props;
const isActive = canDrop && isOver;
let backgroundColor = '#FFFFFF';
if (isActive){
backgroundColor ='#F7F7BD';
} else if (canDrop){
backgroundColor = '#F7F7F7';
@Eyongkevin
Eyongkevin / dnd_phone.js
Created July 2, 2020 18:09
sample code for the tut `Build a Shopping Cart with React, Redux, and React-DnD`
class Phone extends Component{
render(){
const { brand } = this.props;
const { isDragging, connectDragSource } = this.props;
const opacity = isDragging? 0.4: 1;
const style={
opacity: opacity
};
const phoneClass = isDragging? 'ui card phone drag': 'ui card phone';
@Eyongkevin
Eyongkevin / dnd_containerPart3.js
Created June 27, 2020 10:10
sample code for the tut `Build a Shopping Cart with React, Redux, and React-DnD`
import React, { Component } from 'react';
import { DndProvider } from 'react-dnd';
import { HTML5Backend } from 'react-dnd-html5-backend';
import Phone from './Phone'
import ShoppingCart from './ShoppingCart'
import MyCart from './MyCart'
class Container extends Component {
render(){
@Eyongkevin
Eyongkevin / dnd_MyCart.js
Last active June 23, 2020 19:45
sample code for the tut `Build a Shopping Cart with React, Redux, and React-DnD`
import React, { Component } from 'react';
class MyCart extends Component {
render(){
return(
<div>
<div class="ui cards">
<div class="ui card centered">
<div class="content">
@Eyongkevin
Eyongkevin / dnd_containerPart2.js
Created June 23, 2020 18:26
sample code for the tut `Build a Shopping Cart with React, Redux, and React-DnD`
import React, { Component } from 'react';
import Phone from './Phone'
import ShoppingCart from './ShoppingCart'
import MyCart from './MyCart'
class Container extends Component {
render(){
const { phones } = this.props
return(
<div class="ui container">
@Eyongkevin
Eyongkevin / dnd_containerDefault.js
Created June 17, 2020 19:12
sample code for the tut `Build a Shopping Cart with React, Redux, and React-DnD`
import React, { Component } from 'react';
import Phone from './Phone'
import ShoppingCart from './ShoppingCart'
class Container extends Component {
render(){
const { phones } = this.props
return(
<div className='container'>
@Eyongkevin
Eyongkevin / dnd_appDefault.js
Created June 17, 2020 18:42
sample code for the tuts `Build a Shopping Cart with React, Redux, and React-DnD`
import React, { Component } from 'react';
import { connect } from 'react-redux'
import '../index.css'
import { _getPhones } from '../utils/_DATA'
import { receivePhones } from '../actions/phones'
import Container from './container'
class App extends Component {
@Eyongkevin
Eyongkevin / text_wrap.py
Created December 14, 2019 12:29
Split text into line of sub-strings base on the font size and a given maximum width.
def text_wrap(text, font, max_width):
"""Wrap text base on specified width.
This is to enable text of width more than the image width to be display
nicely.
@params:
text: str
text to wrap
font: obj
font of the text