Skip to content

Instantly share code, notes, and snippets.

Avatar

Victor inwardmovement

View GitHub Profile
@inwardmovement
inwardmovement / index.js
Created Jan 2, 2020
Copy text on click (using JS)
View index.js
// DISCORD COPY
function copyDiscord(discordTag) {
navigator.clipboard.writeText(discordTag).then(function() {
/* success */
$('button.discord').tooltip('show');
setTimeout(function(){
$('button.discord').tooltip('hide')
}, 2000);
}, function() {
/* fail */
@inwardmovement
inwardmovement / layouts\_default\_markup\render-link.html
Last active Jan 3, 2020
Open external links in new tabs with Hugo (using render hooks)
View layouts\_default\_markup\render-link.html
@inwardmovement
inwardmovement / layouts\partials\styles.html
Last active Jan 4, 2020
Add external link icon with Hugo (using CSS)
View layouts\partials\styles.html
<style>
a[href^="http"]:not([href^="{{ (urls.Parse .Page.Permalink).Scheme }}://{{ (urls.Parse .Page.Permalink).Host }}"]):not(.no-external-icon)::after
{
content: 'launch';
padding-left: 4px;
position: inline-block;
font-family: 'Material Icons';
font-weight: normal;
font-style: normal;
font-size: 18px;
@inwardmovement
inwardmovement / index.js
Last active Jan 27, 2020
Top button (using JS)
View index.js
// TOP BUTTON
window.onscroll = function() {scrollFunction()};
function scrollFunction() {
if (document.body.scrollTop > 0 || document.documentElement.scrollTop > 0) {
document.getElementById("top-btn").style.display = "block";
} else {
document.getElementById("top-btn").style.display = "none";
}
}
@inwardmovement
inwardmovement / index.js
Last active Feb 21, 2020
Add external links icon (using JS)
View index.js
// EXTERNAL LINKS
var links = $(document.links).filter(function() {
return this.hostname !== location.hostname
&& !this.classList.contains('no-external-icon');
});
for (var i = 0; i < links.length; i++) {
links[i].innerHTML += " <svg class=\"bi bi-box-arrow-up-right\" width=\"1em\" height=\"1em\" viewBox=\"0 0 20 20\" fill=\"currentColor\" xmlns=\"http://www.w3.org/2000/svg\"><path fill-rule=\"evenodd\" d=\"M3.5 15A1.5 1.5 0 005 16.5h8a1.5 1.5 0 001.5-1.5v-4a.5.5 0 00-1 0v4a.5.5 0 01-.5.5H5a.5.5 0 01-.5-.5V7a.5.5 0 01.5-.5h4a.5.5 0 000-1H5A1.5 1.5 0 003.5 7v8zm7-11a.5.5 0 01.5-.5h5a.5.5 0 01.5.5v5a.5.5 0 01-1 0V4.5H11a.5.5 0 01-.5-.5z\" clip-rule=\"evenodd\"/><path fill-rule=\"evenodd\" d=\"M16.354 3.646a.5.5 0 010 .708l-8 8a.5.5 0 01-.708-.708l8-8a.5.5 0 01.708 0z\" clip-rule=\"evenodd\"/></svg>";
}
@inwardmovement
inwardmovement / gist:6f45914eaa3f68dc07389ac5a0f0bc4c
Created Mar 29, 2020
Bypass a parent's width to take the full width
View gist:6f45914eaa3f68dc07389ac5a0f0bc4c
https://twitter.com/Una/status/951519740840873984
.full-width {
position: relative;
width: 100vw;
left: 50%;
right: 50%;
margin-left: -50vw;
margin-right: -50vw;
}
@inwardmovement
inwardmovement / cloudSettings
Last active Feb 5, 2021
Visual Studio Code Settings
View cloudSettings
{"lastUpload":"2021-02-05T14:58:45.827Z","extensionVersion":"v3.4.3"}
View dac-algonews-wordpress-widget.html
<img class="alignleft wp-image-9823" style="border: none;" src="https://www.droitaucorps.com/wp-content/uploads/2020/05/logo-new-trans.png" alt="" width="82" height="82" />
<p style="margin-top: -1em;">Droit au Corps publie la synthèse de ses initiatives dans l’AlgoNews, la revue de l’<a style="color: #0399d1;" href="http://algosphere.org/" target="_blank" rel="noopener">Alliance Algosphère</a> dont notre collectif fait partie.</p>
&nbsp;
<p style="text-align: center;"><a style="color: #42beec; border: 1px solid #42beec; padding: 7px; text-decoration: none; border-radius: 3px;" href="http://eepurl.com/deVD4j" target="_blank" rel="noopener"><strong>S'abonner</strong></a></p>
View layouts\partials\styles.html
{{ with .Site.IsServer }}
<!-- Do not inline styles -->
<link rel="stylesheet" href="{{ $mainCSS.RelPermalink }}">
{{ end }}
<style>
{{ with or (getenv "PREVIEW") (getenv "PRODUCTION") }}
<!-- Inline styles -->
{{ $mainCSS.Content | safeCSS }}
{{ end }}