Skip to content

Instantly share code, notes, and snippets.

View roman01la's full-sized avatar
🇺🇦

Roman Liutikov roman01la

🇺🇦
View GitHub Profile
@roman01la
roman01la / ListContainer.jsx
Last active April 13, 2017 13:45 — forked from mpj/templating_problems.MD
Templating critique
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>
@roman01la
roman01la / index.jsx
Last active September 14, 2015 13:05
function callWithEventValue(fn) {
return comp(fn, lenseTo('target', 'value'));
}
class SomeComponent extends React.Component {
render() {
return (
<div>
//...
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 () {
// Boring
if (isThisAwesome) {
alert('yes'); // it's not
}
// Awesome
isThisAwesome && alert('yes');
// Also cool for guarding your code
var aCoolFunction = undefined;
var message = "hello, how are you Tal?";
if (~message.indexOf('Tal')) {
console.log('found matching text');
}
@roman01la
roman01la / resize.js
Created July 31, 2012 16:16 — forked from robtarr/resize.js
Google Analytics Resize Tracking
(function() {
var resizeTimer;
// Assuming we have jQuery present
$( window ).on( "resize", function() {
// Use resizeTimer to throttle the resize handler
clearTimeout( resizeTimer );
resizeTimer = setTimeout(function() {
@roman01la
roman01la / animLoopX.js
Created July 28, 2012 14:41 — forked from louisremi/animLoopX.js
Animation loop with requestAnimationFrame
// 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;