Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
let ListContainer = ({ items }) => | |
<div className="list-container"> | |
{items.length ? <ul> | |
{items.map(item => | |
<li key={item.id}>{item.name}</li>} | |
</ul> : <p>No items found</p>} | |
</div> |
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
function callWithEventValue(fn) { | |
return comp(fn, lenseTo('target', 'value')); | |
} | |
class SomeComponent extends React.Component { | |
render() { | |
return ( | |
<div> | |
//... |
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
function FwAjax3(host, cb) { | |
var req = function() { | |
try{ return new XMLHttpRequest();} catch(e){} | |
try{ return new ActiveXObject("Msxml2.XMLHTTP.6.0") }catch(e){} | |
try{ return new ActiveXObject("Msxml2.XMLHTTP.3.0") }catch(e){} | |
try{ return new ActiveXObject("Msxml2.XMLHTTP") }catch(e){} | |
try{ return new ActiveXObject("Microsoft.XMLHTTP") }catch(e){} | |
return null; | |
}(), | |
boundary = function () { |
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
// Boring | |
if (isThisAwesome) { | |
alert('yes'); // it's not | |
} | |
// Awesome | |
isThisAwesome && alert('yes'); | |
// Also cool for guarding your code | |
var aCoolFunction = undefined; |
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 message = "hello, how are you Tal?"; | |
if (~message.indexOf('Tal')) { | |
console.log('found matching text'); | |
} |
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
(function() { | |
var resizeTimer; | |
// Assuming we have jQuery present | |
$( window ).on( "resize", function() { | |
// Use resizeTimer to throttle the resize handler | |
clearTimeout( resizeTimer ); | |
resizeTimer = setTimeout(function() { |
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
// Cross browser, backward compatible solution | |
(function( window, Date ) { | |
// feature testing | |
var raf = window.mozRequestAnimationFrame || | |
window.webkitRequestAnimationFrame || | |
window.msRequestAnimationFrame || | |
window.oRequestAnimationFrame; | |
window.animLoop = function( render, element ) { | |
var running, lastFrame = +new Date; |