Skip to content

Instantly share code, notes, and snippets.

Avatar
🐌
work work work

Andreas Kar thexmanxyz

🐌
work work work
View GitHub Profile
@thexmanxyz
thexmanxyz / Simple-Copyright-Generator.php
Last active Mar 20, 2020
Simple PHP Copyright Generator
View Simple-Copyright-Generator.php
View Async-Google-reCAPTCHA-Loading.js
// you probably also want to prevent container resizing
// please use this CSS which works fine with the default v2 reCAPTCHA: .g-recaptcha { height: 78px; min-height: 78px; }
var loadRecaptchaAsync = function() {
// determine if container is in viewport
// you might pass an offset in pixel - a negative offset will trigger loading earlier, a postive value later
// credits @ https://stackoverflow.com/a/33979503/2379196
var isInViewport = function($container, offset) {
var containerTop = $container.offset().top;
var containerBottom = containerTop + $container.outerHeight();
View Async-Google-Maps-Loading.js
// to make this code working for your Google Maps <iframe> please change the src-attribute to data-src and add the class g-maps
// e.g. <iframe class="g-maps" data-src="{your-google-maps-url}" width="100%" height="400" frameborder="0" style="border:0" allowfullscreen></iframe>
// you probably also want to prevent container resizing, please use this CSS with your height value: .g-maps { min-height: 400px; }
var loadGMapAsync = function() {
// determine if container is in viewport
// you might pass an offset in pixel - a negative offset will trigger loading earlier, a postive value later
// credits @ https://stackoverflow.com/a/33979503/2379196
var isInViewport = function($container, offset) {
var containerTop = $container.offset().top;
@thexmanxyz
thexmanxyz / SD-Ethernet-Buffered-Read-Write.c
Last active Mar 6, 2020
Arduino - SD.h / Ethernet.h - Buffered file read / write
View SD-Ethernet-Buffered-Read-Write.c
int bufferSize = 64; // buffer size you want to use
while(file.available()) // file you previously pointed at
{
char buffer[bufferSize];
memset(buffer, '\n', bufferSize); // don't forget to fill the buffer with \n to prevent errors on last buffer read
file.read(&buffer, bufferSize); // read from file
client->write(buffer, bufferSize); // write to client
}
@thexmanxyz
thexmanxyz / Scrollspy-Dynamic-Offset.js
Last active Mar 6, 2020
Bootstrap 4 - Scrollspy dynamic navbar offset
View Scrollspy-Dynamic-Offset.js
var initScrollSpy = function() {
var navContainer = '#mainNav'; // your navigation container
// initial bind of scrollspy
var bindScrollSpy = function() {
$('body').scrollspy({
target: navContainer,
offset: getOffset() // determine your offset
});
}