Skip to content

Instantly share code, notes, and snippets.

View yussan's full-sized avatar
🏠
Working from home everyday

yussan yussan

🏠
Working from home everyday
View GitHub Profile
@yussan
yussan / addthis_reload.js
Created January 26, 2018 07:06 — forked from jonathanconway/addthis_reload.js
Reload (or initialize) addThis social share buttons. Useful when implementing addThis in a SPA (Single Page Application).
// Reload (or initialize) addThis social share buttons.
// IMPORTANT: make sure you put in a correct pubid on line 7.
window.addthis_reload = function () {
if (!window.addthis) {
// Load addThis, if it hasn't already been loaded.
window['addthis_config'] = { 'data_track_addressbar' : false };
$('body').append('<script type="text/javascript" src="//s7.addthis.com/js/300/addthis_widget.js#pubid={YOUR PUBID HERE}"></script>');
} else {
// Already loaded? Then re-attach it to the newly rendered set of social icons.
// And reset share url/title, so they don't carry-over from the previous page.
@yussan
yussan / multilineElipsis.css
Last active October 6, 2021 13:20 — forked from vorvulev/multiline_elipsis.css
Multiline elipsis with overflow
.block-ellipsis {
display: block;
display: -webkit-box;
max-width: 100%;
height: 43px;
margin: 0 auto;
font-size: 14px;
line-height: 1;
-webkit-line-clamp: 3;
-webkit-box-orient: vertical;
@yussan
yussan / iso2FlagEmoji.js
Created June 21, 2022 03:35 — forked from sandgraham/iso2FlagEmoji.js
Convert a country's ISO-2 string to a flag emoji in a single line
const iso2FlagEmoji = iso => String.fromCodePoint(...[...iso.toUpperCase()].map(char => char.charCodeAt(0) + 127397));
iso2FlagEmoji("US"); // "🇺🇸"