Skip to content

Instantly share code, notes, and snippets.

View IllusionElements's full-sized avatar

Aaron Lo IllusionElements

View GitHub Profile
@IllusionElements
IllusionElements / index.html
Created May 25, 2018 00:36
React Scratchpad
<head>
<script crossorigin src="https://unpkg.com/react@16/umd/react.development.js"></script>
<script crossorigin src="https://unpkg.com/react-dom@16/umd/react-dom.development.js"></script>
</head>
<body>
<div id="root"></div>
</body>
//GET STREAMS
{
"_links":{
"self":"https://api.twitch.tv/kraken/streams/freecodecamp",
"channel":"https://api.twitch.tv/kraken/channels/freecodecamp"
},
"stream":null
}
//GET USERS
function replace(str, before, after) {
var aslice = after.slice(1);
if(before[0] === before[0].toUpperCase()){
var caps = after.charAt(0).toUpperCase() + aslice;
return str.replace(before, caps);
}
else if(after[0] === after[0].toUpperCase() && before[0] === before[0].toLowerCase()){
var low = after.charAt(0).toLowerCase() + aslice;
return str.replace(before, low);
}