This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
124,126c120,121 | |
< -webkit-box-sizing: content-box; | |
< box-sizing: content-box; | |
< background-color: transparent; | |
--- | |
> box-sizing: initial; | |
> background-color: initial; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import withState from 'recompose/withState' | |
import compose from 'recompose/compose' | |
import withHandlers from 'recompose/withHandlers' | |
import stringCapitalize from 'somewhere' | |
const addToSetFactory = (stateName, stateUpdaterName) => props => item => | |
props[stateUpdaterName](new Set(props[stateName]).add(item)) | |
const removeFromSetFactory = (stateName, stateUpdaterName) => props => item => |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Or better: | |
// same imports as before plus... | |
import compose from 'recompose/compose' | |
const Farm = compose( | |
withState("tools", "setTools", ["hammer", "scythe", "sickle"]), | |
lifecycle({ didMount }), | |
branch(shouldNotRender, renderNothing), |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import branch from 'recompose/branch' | |
import withState from 'recompose/withState' | |
import renderNothing from 'recompose/renderNothing' | |
import onlyUpdateForKeys from 'recompose/onlyUpdateForKeys' | |
import lifecycle from 'out-of-scope-for-this-article-but-serves-same-purpose-as-recompose-lifecycle' | |
// And now the exact same thing, written functionally. | |
//---------------------------------------------------------------// | |
// Only the 'view' logic. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//------------------Written as a class---------------------// | |
class Farm extends React.Component { | |
constructor(props) { | |
super(props) | |
this.state = { | |
tools: ["hammer", "scythe", "sickle"] | |
} | |
} | |
componentDidMount() { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Bash: alias git yolo='git push --force-with-lease' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'use strict' | |
declare var require: any | |
import VueComponent from 'vue-class-component' | |
@VueComponent({ | |
template: require('./Tabs.html') | |
}) | |
export default class { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var url = "http://free.rome2rio.com/api/1.4/json/Search?"; | |
function runner(long,lati) { | |
//get the response with given long lat: | |
var data = { | |
key: destination.key, | |
dPos: destination.position, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//regex object which has a regex string for match checking and an array of params that looks like: | |
//params = [null,param1,param2,..,param(n)[ | |
//method for creating a reg ex object (as described in the use case constructor), from a given resource path. | |
function create_reg(resource) { | |
var folders = resource.split('/'); | |
var reg_string = '^'; | |
var reg_obj={}; | |
var params=[null]; | |
for (var i = 0; i < folders.length; i++) { |