Skip to content

Instantly share code, notes, and snippets.

View Damian96's full-sized avatar

Damianos Giankakis Damian96

View GitHub Profile
@akarsh1995
akarsh1995 / b64toFile.ts
Last active May 6, 2026 07:08
Convert base64 data-url to javascript File object
// to quickly try the script open
// https://www.typescriptlang.org/play?#code/JYOwLgpgTgZghgYwgAgJICE4GcIDYAsAInGHMgN4BQyyAtsLRACoCeADhAFzJZhSgBzADTVkMYABsIIOI269+IYaIgAPSCCzAA9iHl9BImgCMCAExJx9igZQC+lSjACuIBGB0hkAfWPY8+EzaAIJQUHAs6M4wMNAAFH44BNaCAJQUogBucFDIxqA5LN4KgsgAvMgk2sYJ-gSpANxZOchSXhX5MlBFJUoAdG0CYAAWTTTZucYskFjlyCAQAO7IAKqgYAAcoeEscW2NojDauXETyMBzAAwN58gAPK3SN8AA1C-pVDQm0xBYANrAAC6c06hWKBn6CGGOQAwtozBBgmA4sADjQHDQoBAwM4oF4pjMmg5HAgJNhZpgkvgAMoQgQZGgWUjcDB1IiWUS+ZI8OmOGgIXQKZzuY61Km0mwpJQfUQ0EbALB9Ln4EFsiWCMZfeWKplkCrIbVKhFC9y4iBxNHIYk0bzGvjCnFYi0Mr4CzRgZACKDaZxsWYVBbLABKEAEAFFVGw4gB6OIAfk4us4cT6ACo441UvHOGmGqlU9mZIwyinU6kADp9UsZvPZ3P5xIBISl1LR1J9NQQBBxQ3Ky38wUev7eIR0BjMdgQUfiNqyKfINQaLS6UemfC64EVL0+v2azHY3FechjxisDjTyTSOfcBEChErIOoOG0Ni6aTImdXxipUeL6TLkBV3MSwrVEa1PWxKIYniVJuDWcAtjCCIXX3R0vF8Nkgm2CIoNiKAe2GBU+l1Po111VIwL5CCwHQCRqgtbhaOqFDkCxND5iWZAmJqP5DQESDojwi1AVHY8wEnbhDRI+hT0nK1LXA-iwAAMUvAA5OcAHVgBGP9NE8BieRsFi2MPZAAAMABJyCkyw+k-IsIDsPprNs0gO3Uf9PDsczNUU7FVKkQzApQT4vlMvEOOWEK4llL5eMIxUlO451sC4
@jordienr
jordienr / Gradient.js
Created September 12, 2021 00:23
Stripe Mesh Gradient WebGL
/*
* Stripe WebGl Gradient Animation
* All Credits to Stripe.com
* ScrollObserver functionality to disable animation when not scrolled into view has been disabled and
* commented out for now.
* https://kevinhufnagl.com
*/
<style>
body { margin: 0; }
.vimeo-container {
padding: 0;
width: 100%;
height: 100vh;
overflow: hidden;
position: relative;
}
iframe {
@taichikuji
taichikuji / README.md
Last active May 5, 2026 07:14
Get a DDNS up and running with DuckDNS - Step by Step

Get a DDNS up and running with DuckDNS - Step by Step

Understanding DDNS

In summary, DDNS stands for Dynamic DNS. DDNS updates a DNS name in real-time to point to a changing IP address. This is useful for devices without a static IP. For example, companies like Google use static IPs and IP ranges, which are more expensive than ephemeral IPs and IP ranges. DDNS provides a cost-effective alternative, linking a hostname to a dynamic IP address.

How Does DDNS Work?

To use DDNS, you need an account with a DDNS provider. While some services are paid, they are still cheaper than static public IPs from ISPs. A script or service on your device updates the DDNS server with your current IP at regular intervals to maintain the link between your hostname and IP address. Luckily for us, DuckDNS is free for everybody and relays on donations to keep their services running.

@rbrahul
rbrahul / Capture-Youtube-Video.js
Last active November 30, 2025 16:03
Capture Screenshot from Youtube Video
var canvas = document.createElement('canvas');
canvas.width = 640;
canvas.height = 480;
var ctx = canvas.getContext('2d');
var video = document.querySelector(".html5-video-container > video");
ctx.drawImage(video, 0, 0, canvas.width, canvas.height);
var dataURI = canvas.toDataURL('image/jpeg');
console.log(dataURI);
@darrenmothersele
darrenmothersele / drop-zone-directive.ts
Last active July 12, 2024 13:05
Angular Drag and Drop File Directive
import { Directive, EventEmitter, HostBinding, HostListener, Input, Output } from '@angular/core';
// Angular Drag and Drop File
//
// Add this directive to an element to turn it into a dropzone
// for drag and drop of files.
// Example:
//
// <div (appDropZone)="onDrop($event)"></div>
//
@inorganik
inorganik / email-subscribe-form.component.ts
Last active July 4, 2025 08:33
MailChimp subscribe form with Angular 5 using jsonp
import { Component } from '@angular/core';
import { FormControl, Validators } from '@angular/forms';
import { HttpClient, HttpParams } from '@angular/common/http';
interface MailChimpResponse {
result: string;
msg: string;
}
@Component({
@shreyans94
shreyans94 / gist:05b10194cf2f57cf054a5cf3da3fd931
Created January 23, 2018 21:32
Display ACF for woocommerce variations in backend
// Render fields at the bottom of variations - does not account for field group order or placement.
add_action( 'woocommerce_product_after_variable_attributes', function( $loop, $variation_data, $variation ) {
global $abcdefgh_i; // Custom global variable to monitor index
$abcdefgh_i = $loop;
// Add filter to update field name
add_filter( 'acf/prepare_field', 'acf_prepare_field_update_field_name' );
// Loop through all field groups
$acf_field_groups = acf_get_field_groups();
foreach( $acf_field_groups as $acf_field_group ) {
@ymdx
ymdx / index.js
Created December 18, 2017 15:05
How to download CSV File from HttpResponse with Ajax
success: function(data) {
var blob=new Blob([data]);
var link=document.createElement('a');
link.href=window.URL.createObjectURL(blob);
link.download="<FILENAME_TO_SAVE_WITH_EXTENSION>";
link.click();
}
@fodra
fodra / javascript-encoding-types.md
Created November 15, 2017 23:45
This is a list of possible encoding type values for everything node/javascript.

Javascript encoding type values

The character encodings currently supported by Node.js include:

  • 'ascii' - For 7-bit ASCII data only. This encoding is fast and will strip the high bit if set.

  • 'utf8' - Multibyte encoded Unicode characters. Many web pages and other document formats use UTF-8.

  • 'utf16le' - 2 or 4 bytes, little-endian encoded Unicode characters. Surrogate pairs (U+10000 to U+10FFFF) are supported.