Some time again I wrote an article on Convert Picture to Information URI with JavaScript. It is a neat trick builders can use for any variety of causes. As a substitute of abusing canvas, nevertheless, why not merely get the base64 knowledge from command line?
You should utilize base64
and pbcopy
to transform a file to base64 and duplicate it to the clipboard:
# base64 will get knowledge, pbcopy copies to clipboard base64 -i emblem.jpeg | pbcopy
After you have the file knowledge copied in base64 format, the URL format to make use of the info is:
# knowledge:{mime-type};base64,{knowledge} knowledge:picture/jpeg;base64,/9j/4AAQSkZJRgAB......
Whereas base64 knowledge and knowledge URIs do look cryptic, they’re helpful to keep away from making requests to different information. I take advantage of them when creating shows or once I cannot rely on a good web connection.
Create Namespaced Lessons with MooTools
MooTools has at all times gotten a little bit of grief for not inherently utilizing and standardizing namespaced-based JavaScript lessons just like the Dojo Toolkit does. Many builders create their lessons as globals which is mostly frowned up. I principally disagree with that stance, however every to their very own. In any occasion…
Desk Cell and Place Absolute
When you observe me on Twitter, you noticed me rage about making an attempt to make
place: absolute
work inside aTD
ingredient orshow: table-cell
ingredient. Chrome? Test. Web Explorer? Test. Firefox? Ugh, FML. I tinkered within the console…and stubborn. I did some researched…and I…CSS Sprites
The concept of CSS sprites is fairly genius. For these of you who do not know the concept of a sprite, a sprite is mainly a number of graphics compiled into one picture. Some great benefits of utilizing sprites are: Fewer pictures for the browser to obtain, which implies…