Skip to content

Instantly share code, notes, and snippets.

View tomhermans's full-sized avatar
👻
tinkering

Tom Hermans tomhermans

👻
tinkering
View GitHub Profile
@fijiwebdesign
fijiwebdesign / detect-available-fonts.js
Last active February 24, 2024 15:04
Detect available fonts with JS
/**
* JavaScript code to detect available availability of a
* particular font in a browser using JavaScript and CSS.
*
* Author : Lalit Patel
* Website: http://www.lalit.org/lab/javascript-css-font-detect/
* License: Apache Software License 2.0
* http://www.apache.org/licenses/LICENSE-2.0
* Version: 0.15 (21 Sep 2009)
* Changed comparision font to default from sans-default-default,
@khromov
khromov / spp.php
Last active April 13, 2023 17:36
Count post view counts in WordPress via AJAX (Compatible with caching plugins)
<?php
/*
Plugin Name: Simple Popular Posts Lite
Plugin URI: -
Description: -
Version: 2015.03.01
Author: khromov
Author URI: http://snippets.khromov.se
License: GPL2
*/
@yoren
yoren / functions.php
Last active September 14, 2022 21:02
Add Featured Image Thumbnail URL to wp-json/wp/v2/posts Endpoint
<?php
function my_rest_prepare_post( $data, $post, $request ) {
$_data = $data->data;
$thumbnail_id = get_post_thumbnail_id( $post->ID );
$thumbnail = wp_get_attachment_image_src( $thumbnail_id );
$_data['featured_image_thumbnail_url'] = $thumbnail[0];
$data->data = $_data;
@moonmilk
moonmilk / dotcollection.json
Created May 31, 2015 23:20
graphics in tracery
{
"origin": [
"<svg width=\"400\" height=\"200\">#pattern#</svg>"
],
"circlecolor": [
"pink",
"cyan",
"yellow",
"orange",
"gray",
@moust
moust / oscilloscope.html
Created June 24, 2015 14:52
Oscilloscope using Web Audio API
<!doctype html>
<html>
<head>
<meta charset="utf-8" />
<title>Oscilloscope</title>
<style type="text/css">
.visualizer {
display: block;
width: 100%;
height: auto;
@aallan
aallan / speedtest-ifttt.sh
Last active May 29, 2022 15:50
Modified version of Henrik Bengtsson's speedtest-cli code which will dispatch the test results to the IFTTT Maker Channel.
#!/usr/bin/env bash
###########################################################################
# Originally written by: Henrik Bengtsson, 2014
# https://github.com/HenrikBengtsson/speedtest-cli-extras
# Modified to use IFTTT by: Alasdair Allan, 2015
# License: GPL (>= 2.1) [http://www.gnu.org/licenses/gpl.html]
###########################################################################
# Character for separating values
# (commas are not safe, because some servers return speeds with commas)
@chrismccoy
chrismccoy / restapi.txt
Last active March 30, 2024 08:17
WordPress REST API Resources
Disable REST Api without Plugins
https://rudrastyh.com/wordpress/disable-rest-api.html
Add featured image & alt text to WP REST API
https://allisontarr.com/2021/10/13/add-featured-image-alt-text-to-wp-rest-api/
Allow ALL cross origin requests to WordPress REST API
https://github.com/Shelob9/rest-all-cors
WordPress theme using Rest API and Vue.js
@zeshanshani
zeshanshani / acf_options_multilingual.php
Last active October 10, 2023 11:25
Creates separate Advanced Custom Fields options pages for the specified languages.
<?php // Don't copy this line if you are inserting in a file that has it already.
/**
* ACF Options Page
*
* Instructions:
* Add more languages to the array below: $languages
*
* @author: Zeshan Ahmed <https://zeshanahmed.com/>
*/
@devlim
devlim / 000-default.conf
Last active September 13, 2023 15:03
Apache default virtual host file, default ssl conf file. /etc/apache2/sites-available/000-default.conf /etc/apache2/sites-available/default-ssl.conf
<VirtualHost *:80>
# The ServerName directive sets the request scheme, hostname and port that
# the server uses to identify itself. This is used when creating
# redirection URLs. In the context of virtual hosts, the ServerName
# specifies what hostname must appear in the request's Host: header to
# match this virtual host. For the default virtual host (this file) this
# value is not decisive as it is used as a last resort host regardless.
# However, you must set it for any further virtual host explicitly.
#ServerName www.example.com
@cblunt
cblunt / gulpfile.js
Created May 11, 2017 21:37
Gulpfile for simple static website prototyping
// $ npm install
// $ gulp serve
// $ open http://localhost:8080
var gulp = require('gulp'),
del = require('del'),
scss = require('gulp-sass'),
htmlmin = require('gulp-htmlmin'),
cleancss = require('gulp-clean-css'),
connect = require('gulp-connect'),