Skip to content

Instantly share code, notes, and snippets.

@pgbovine
Created February 10, 2014 04:25
Show Gist options
  • Save pgbovine/8910348 to your computer and use it in GitHub Desktop.
Save pgbovine/8910348 to your computer and use it in GitHub Desktop.
JavaScript Gist for 6.813 Lecture 2
var result = document.evaluate("//text()", document.body, null, XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE, null) ;for (var i = 0; i < result.snapshotLength; ++i) {var node = result.snapshotItem(i);if ((node.textContent+"").match(/\w/)&&node.parentNode.nodeName != "STYLE") {node.textContent = node.textContent.replace(/[A-Z0-9]/g, "X").replace(/[a-z]/g, "x");}}void 0
@lingxiao
Copy link

lingxiao commented Jul 29, 2018

A example use case below:

export default class OneFeed extends Component {

	GET = async () => 
		await getRecommendations(this.props.screenProps.uid);

	/**
		@right now you need to figure out the loading state render ...
	*/
	renderItem = ({ item }) => {

		if (!item)
			return null;

		const name = item.displayName 
			? item.displayName
			: '';

		const image_src = item.thumbURI 
			? { uri: item.thumbURI } 
			: blank;

		const image = <Thumbnail source={image_src} />

        return (
        	<TouchableOpacity onPress={() => this.props.onFollow(name)} >
				<CardItem >
	                <Body style={whoToFollow.box}>
	                    {image}
	                    <Text label={name} style={whoToFollow.caption}/>
	                </Body>
	           </CardItem>
	        </TouchableOpacity>
	    )
	}


	render = () =>
        <SpiceFlatList
			horizontal   = {true}
            getData      = {this.GET          }
            renderItem   = {this.renderItem   }
            keyExtractor = {item => item.uid  }
            {...this.props}
        />

}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment