Skip to content

Instantly share code, notes, and snippets.

View asvny's full-sized avatar
🎯
Focusing

Annamalai Saravanan asvny

🎯
Focusing
View GitHub Profile
@asvny
asvny / bind.js
Created November 24, 2015 16:30 — forked from WickyNilliams/bind.js
Super simple one-way data-binding
/**
* follows a path on the given data to retrieve a value
*
* @example
* var data = { foo : { bar : "abc" } };
* followPath(data, "foo.bar"); // "abc"
*
* @param {Object} data the object to get a value from
* @param {String} path a path to a value on the data object
* @return the value of following the path on the data object
@asvny
asvny / auto_curry.js
Created October 6, 2015 12:03 — forked from cem2ran/auto_curry.js
Auto-currying for the masses
Function.prototype._curry = function (f=this) {
return (...args) => args.length < f.length
? f._curry(args.reduce((g, arg) => g.bind(null, arg), f))
: f.apply(null, args);
};
@asvny
asvny / what-forces-layout.md
Last active September 22, 2015 06:19 — forked from paulirish/what-forces-layout.md
What forces layout/reflow. The comprehensive list.

What forces layout / reflow

All of the below properties or methods, when requested/called in JavaScript, will trigger the browser to synchronously calculate the style and layout. This is also called reflow or layout thrashing, and is common performance bottleneck.

Element

Box metrics
  • elem.offsetLeft, elem.offsetTop, elem.offsetWidth, elem.offsetHeight, elem.offsetParent
  • elem.clientLeft, elem.clientTop, elem.clientWidth, elem.clientHeight
  • elem.getClientRects(), elem.getBoundingClientRect()
@asvny
asvny / spring-collection
Last active September 10, 2015 08:04 — forked from nicebarbarian/spring-collection
framer.js: spring collection
exessiveSpring = "spring(200, 15, -3)"
gentleSpring = "spring(40, 5, 0)"
swingSpring = "spring(120, 15, 0)"
smoothSpring = "spring(100, 20, 0)"
superSlowSpring = "spring(30, 20, 0)"
slowSpring = "spring(100, 15, -3)"
snapSpring = "spring(200, 20, 0)"
tightSpring = "spring(300, 25, 0)"
straightSpring = "spring(500, 40, 0)"
@asvny
asvny / SassMeister-input.scss
Created September 3, 2015 13:42
Generated by SassMeister.com.
// ----
// libsass (v3.2.5)
// ----
$themes: (
theme1: theme-light,
theme2: theme-dark
);
@function setStyle($map, $object, $style) {
@asvny
asvny / SassMeister-input.scss
Created September 3, 2015 13:32
Generated by SassMeister.com.
// ----
// libsass (v3.2.5)
// ----
$breakpoints: (
small: 320px,
medium: 600px,
large: 768px
);
@asvny
asvny / SassMeister-input.scss
Created September 3, 2015 13:31
Generated by SassMeister.com.
// ----
// libsass (v3.2.5)
// ----
$buttons: (
error: (#d82d2d, #666),
success: (#52bf4a, #fff),
warning: (#c23435, #fff)
);
@asvny
asvny / SassMeister-input.scss
Created September 3, 2015 13:24
Generated by SassMeister.com.
// ----
// libsass (v3.2.5)
// ----
$card_morph: (
trans1: 200ms transform ease-in-out,
trans2: 400ms background ease-in,
trans3: 600ms color linear
);
//SCSS
$pages: ('home', 'about', 'products', 'contact');
$selector: ();
@each $item in $pages {
$selector: append($selector, unquote('.#{$item} .nav-#{$item}'), 'comma');
}
#{$selector} {
@asvny
asvny / GradientBorder.scss
Created August 10, 2015 09:51
Gradient border SCSS mixin
@mixin gradientBorder($leftColor,$rightColor,$borderWidth)
{
-webkit-appearance:none;
border:none;
background-image:linear-gradient(to right,$leftColor,$rightColor),linear-gradient(to right,$leftColor,$rightColor);
outline:none;
border-left:$borderWidth solid $leftColor;
border-right:$borderWidth solid $rightColor;
background-repeat:no-repeat;
background-size:100% $borderWidth;