JavaScript class for creating simple charts in Canvas. Uses requestAnimationFrame for smooth animations and includes options for variable speed and multiple linear gradient stops. Includes HiDPI resize.
A Pen by Justin Perry on CodePen.
| function addClass(elem, newClass) { | |
| var curClass = elem.className; | |
| if(!new RegExp(newClass,'i').test(curClass)){ | |
| if(curClass.length > 0 && curClass.charAt(curClass.length) === '') { | |
| newClass = ' ' + newClass; | |
| } | |
| elem.className += newClass; | |
| } | |
| }; |
| var history = []; | |
| this.listenTo(this, 'route', function (name, args) { | |
| history.push({ | |
| name : name, | |
| args : args, | |
| fragment : Backbone.history.fragment | |
| }); | |
| }); |
JavaScript class for creating simple charts in Canvas. Uses requestAnimationFrame for smooth animations and includes options for variable speed and multiple linear gradient stops. Includes HiDPI resize.
A Pen by Justin Perry on CodePen.
Vanilla JS image slideshow with CSS3 transition
A Pen by Justin Perry on CodePen.
| mystr.replace(/<%=.+?%>/g, function(a,b){ return a;}) |
| <.+?> | |
| <a href="http://www.google.com">Google</a> | |
| <a class="myclass" href="http://www.bbc.co.uk">BBC</a> | |
| <a id="myid" href="http://www.yahoo.com" class="myclass">Yahoo</a> | |
| <div><a href="http://www.google.com">Google</a></div> |
| #[^\/\?]+ |
Example of sticky columns using flexbox.
A Pen by Justin Perry on CodePen.
| <div class="flex"> | |
| <!--div*6>table>tr*8>tr*8>td*7>{Eius facere reprehenderit esse praesentium eligendi.}--> | |
| <div> | |
| <table> | |
| <col style="width: auto" /> | |
| <col style="width: 20%" /> | |
| <col style="width: 30%" /> | |
| <col style="width: 20%" /> | |
| <col style="width: 10%" /> | |
| <col style="width: 10%" /> |