Skip to content

Instantly share code, notes, and snippets.

@hobelinm
hobelinm / languageselector.js
Last active October 19, 2017 17:35
Simple language selector to apply language changes to a page
$(document).ready(function(){
// Set appropriate language by default
if (localStorage.languageSelection) {
if(localStorage.languageSelection == "spanish") {
$(".spanish").show();
$(".english").hide();
}
else {
localStorage.languageSelection = "english";
$(".english").show();
<script
src="https://code.jquery.com/jquery-3.3.1.min.js"
integrity="sha256-FgpCb/KJQlLNfOu91ta32o/NMZxltwRo8QtmkMRdAu8="
crossorigin="anonymous">
</script>
<script>
if(localStorage.getItem('IsDebug') === 'true') {
console.log('Debug mode, no redirection');
return;
}
@hobelinm
hobelinm / carousel.html
Created August 16, 2020 19:06
Bootstrap Carousel Short-code with support for language
@hobelinm
hobelinm / auto-instagram.ts
Created August 17, 2020 01:21
Calls Instagram oEmbed to insert Instagram posts
namespace AutoInstagram {
export class Control {
/**
* Find Instagram Id if passed via query parameter
*/
public static LoadFromParam(): string {
let url: URL = new URL(location.toString());
let instaId: string = url.searchParams.get(Constants.QuerySegment);
let instagramId: string = '';
if (instaId === null) {
@hobelinm
hobelinm / single.html
Created August 17, 2020 02:41
Custom single partial that allows hiding UI
{{ define "header" }}
{{/* We can override any block in the baseof file be defining it in the template */}}
{{ if not .Params.barePage }}
{{ partial "page-header.html" . }}
{{ end }}
{{ end }}
{{ define "main" }}
{{ $section := .Site.GetPage "section" .Section }}
<article class="flex-l flex-wrap justify-between mw8 center ph3">
@hobelinm
hobelinm / autoinstagram.html
Created August 17, 2020 03:05
Shortcode that connects auto-instagram.ts library with Hugo framework posts
<script type="text/javascript">
//< autoinstagram "fromUrl" "Instagram-Auto-Embed" >
//< autoinstagram "123qwer" "Instagram-Auto-Embed" >
{{ if eq (.Get 0) "fromUrl" }}
if (window.AutoInstagram.Control.LoadFromParam() === '') {
// Loads error image
window.AutoInstagram.Control.QueryAndAddInstagramPost(
'CDqPPKxp1cT',
{{.Get 1}}
@hobelinm
hobelinm / instagram.md
Created August 17, 2020 03:17
Hugo's post that uses auto instagram shortcode
title date draft barePage
Instagram
2020-01-14 12:08:35 -0700
false
true

Instagram-Auto-Embed

{{< autoinstagram "fromUrl" "Instagram-Auto-Embed" >}}

@hobelinm
hobelinm / tableau.html
Last active February 24, 2024 23:21
Hugo shortcode to embed Tableau Vizzes
{{/* Featured on: */}}
{{/* https://brewingcats.com/posts/projects/software/tableauparser/ */}}
{{/* https://brewingcats.com/es/posts/projects/software/tableauparser/ */}}
{{/* tableau "viz_id" "view_pre" "view_id" "view_name" */}}
<div class='tableauPlaceholder' id='{{.Get 0 }}' style='position: relative'>
<noscript>
<a href='#'>
<img alt=' '
src='https:&#47;&#47;public.tableau.com&#47;static&#47;images&#47;{{.Get 1 }}&#47;{{.Get 2 }}&#47;{{.Get 3 }}&#47;1_rss.png'
style='border: none' />

Keybase proof

I hereby claim:

  • I am hobelinm on github.
  • I am hugobelin (https://keybase.io/hugobelin) on keybase.
  • I have a public key ASDzjUgQpntvlbV1zXaNg--deUQLHXfR4qGcM08ZNTqZ6wo

To claim this, I am signing this object: