Skip to content

Instantly share code, notes, and snippets.

View cahva's full-sized avatar

Markku Virtanen cahva

View GitHub Profile
@cahva
cahva / inject-id-to-link.html
Last active February 22, 2024 12:46
inject id from search params to data-inject-qs elements
@cahva
cahva / calcdiff.js
Last active October 9, 2023 12:11
Calculate difference between dates in days, hours, mins and secs
function getDifference(toD, fromD = new Date(), zeroPad = false) {
let d1 = new Date(fromD); // Current date and time
let d2 = new Date(toD); // Target date and time
// Calculate difference in milliseconds
let diffMs = Math.abs(d2 - d1);
// Convert to respective units
let diffSeconds = Math.floor(diffMs / 1000);
let diffMinutes = Math.floor(diffSeconds / 60);
@cahva
cahva / gist:411822c9e86ea7499b19e2b64572ddac
Last active March 8, 2022 10:27
Delete old snapshots from ofs
We couldn’t find that file to show.
@cahva
cahva / privacypolicy.md
Last active February 28, 2022 16:37
Videosync privacy policy

Privacy Policy

Videosync privacy statement

Flik Media Group, the creator of Videosync service, is committed to protecting your privacy and personal data. This privacy statement (“Privacy Statement”) explains how Flik Media Group and its authorised partners and affiliates (“Flik”) process personal data in connection with the Videosync service (“Service”).

Personal data is information that is about you as an identifiable individual. Aggregated, statistical or de-identified information is not personal information. Information generated through your use of our websites or watching videos will not be personal information unless we can combine it with other information that would identify you.

The term “personal data”, as used in this Privacy Statement, refers to any information about you which can be used to personally identify you, such as your name, address, telephone number, e-mail address, or any other personal information you might supply.

@cahva
cahva / git-submodule-rewrite
Last active February 9, 2022 13:54
Git submodule rewrite
#!/usr/bin/env bash
# This script builds on the excellent work by Lucas Jenß, described in his blog
# post "Integrating a submodule into the parent repository", but automates the
# entire process and cleans up a few other corner cases.
# https://x3ro.de/2013/09/01/Integrating-a-submodule-into-the-parent-repository.html
function usage(){
echo "Usage: $0 <submodule-name> [<submodule-branch>]"
echo "Merge a single branch of <submodule-name> into a repo, retaining file history."
@cahva
cahva / rename-file-extensions-git.sh
Created February 7, 2022 09:41
Shell script to rename files to another extension in git
#/bin/bash
for i in $(find . -iname "*.jade"); do
git mv "$i" "$(echo $i | rev | cut -d '.' -f 2- | rev).pug";
done
@cahva
cahva / dailyco.html
Last active April 13, 2021 11:28
Daily.co embed own js
<style>
#callframe {
height: 75vh;
min-height: 400px;
}
</style>
<script crossorigin src="https://unpkg.com/@daily-co/daily-js"></script>
<script>
@cahva
cahva / redirect_to_event_after_agree_to_disclaimer.html
Created January 7, 2021 16:56
Redirects to the event page after agreeing to disclaimer
<script src="https://getvideosync.com/js/vs-helpers.js"></script>
<script>
var isRegister = window.location.href.indexOf('register') > -1;
if (isRegister) {
waitForElement('.modal', handleModalClose);
}
function handleModalClose(modalNode) {
var config = {
@cahva
cahva / add_querystring_to_links.html
Last active October 23, 2020 09:17
Add current querystring to links
@cahva
cahva / hide_cookie_query_window_when_embed.html
Created September 4, 2020 15:25
Hide cookie query window when url has embed_view in it