Skip to content

Instantly share code, notes, and snippets.

View vonlooten's full-sized avatar
💯
Let's go!

vonlooten

💯
Let's go!
View GitHub Profile
@agent4788
agent4788 / HS100.java
Last active November 17, 2023 13:34
Mit dieser kleinen API kann man die TP-Link HS100 und HS110 Wlan Steckdosen direkt aus Java ansteuern.
package de.test;
import com.google.gson.JsonElement;
import com.google.gson.JsonObject;
import com.google.gson.JsonParser;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.net.InetAddress;
@jjmu15
jjmu15 / in_viewport.js
Created January 27, 2014 10:19
check if element is in viewport - vanilla JS. Use by adding a “scroll” event listener to the window and then calling isInViewport().
// Determine if an element is in the visible viewport
function isInViewport(element) {
var rect = element.getBoundingClientRect();
var html = document.documentElement;
return (
rect.top >= 0 &&
rect.left >= 0 &&
rect.bottom <= (window.innerHeight || html.clientHeight) &&
rect.right <= (window.innerWidth || html.clientWidth)
);
@daviddarnes
daviddarnes / Anchor Custom Background Image Field
Last active October 22, 2020 17:30
Custom Image field for Anchor CMS themes.
<div class="bg-header"
<?php
/*
This is to show a custom field from an article.
It will need to be created in the metadata section before it can be used in the post edit area.
In this case the custom field will need to be called 'image' and be set as an image custom field in the dropdown for type.
*/
$image = article_custom_field('image'); // Applying a variable to the custom field, so it can be reused with ease
if ( !empty($image) ) : // Check if the field is empty, if it is the process stops here
?>