Skip to content

Instantly share code, notes, and snippets.

View drikusroor's full-sized avatar
🏠
Working from anywhere

Drikus Roor drikusroor

🏠
Working from anywhere
  • Utrecht, Netherlands
View GitHub Profile
@gmmedia
gmmedia / functions.php
Last active March 11, 2023 10:06
Add featured image column to WP admin panel - posts AND pages
<?php
/**
* Add featured image column to WP admin panel - posts AND pages
* See: https://bloggerpilot.com/featured-image-admin/
*/
// Set thumbnail size
add_image_size( 'j0e_admin-featured-image', 60, 60, false );
@ctlcltd
ctlcltd / wordpress_low-quality-image-placeholders_lqip.md
Last active June 22, 2023 20:08
How to easily generate low quality image placeholders (lqip) in WordPress

How to easily generate low quality image placeholders (lqip) in WordPress

I have made this function using the WP_Image_Editor class and I have filtered through the "wp_generate_attachment_metadata" hook. You can modify the "theme" namespace into function names with your theme name or in anyway you like.

Applying the filter directly to wp_generate_attachment_metadata the image placeholders are auto added into WordPress metadata, so when your add/modify/delete an image (or regenerate it via a plugin), it accomplishes to modify also to the image placeholders.

The use of the native theme support can prevent the generation of lqip or target specific image sizes to generate.

It contains an hook filter lqip_quality to modify the quality without have to modify the function.

@danieliser
danieliser / es5.js
Last active February 27, 2024 23:11
Convert Hex Color to rgba with opacity
/**
* ECMA2015
*/
function convertHex(hexCode, opacity = 1){
var hex = hexCode.replace('#', '');
if (hex.length === 3) {
hex = hex[0] + hex[0] + hex[1] + hex[1] + hex[2] + hex[2];
}
@dmrd
dmrd / imdb
Created March 4, 2014 04:49
Simple IMDB scraping script
# Simple IMDB scraping script
# David Dohan
import urllib2
import bs4
import sys
import time
import json
def scrape_movies(url):
@rodyhaddad
rodyhaddad / timeago.filter.js
Created June 30, 2013 21:04
timeago filter for angularjs
.filter("timeago", function () {
//time: the time
//local: compared to what time? default: now
//raw: wheter you want in a format of "5 minutes ago", or "5 minutes"
return function (time, local, raw) {
if (!time) return "never";
if (!local) {
(local = Date.now())
}