Skip to content

Instantly share code, notes, and snippets.

@a1ip
a1ip / youtube-video-thumbnails-sizes-and-formats.md
Created April 7, 2020 18:53
YouTube video thumbnails sizes and formats

Note: YouTube is serving thumbnails from 2 servers:

  • //img.youtube.com
  • //i.ytimg.com

Examples are with //i.ytimg.com server just because it’s shorter, no other particular reason. You can use both.

  • Player Background Thumbnail (480x360):

@mariuskubilius
mariuskubilius / extractTranslationStrings.php
Created January 23, 2019 15:09
Laravel artisan command to extract translation strings from templates and add them into {language}.json file for localization.
<?php
namespace App\Console\Commands;
use Illuminate\Console\Command;
use Illuminate\Support\Facades\File;
class extractTranslationStrings extends Command
{
@rmpel
rmpel / in-your-application.php
Last active April 22, 2024 18:45
WordPress REST-API in website, NONCE problems when authenticating or de-authenticating (login / logout)
<?php
// sent an updated nonce to the front-end on each request
add_filter( 'rest_post_dispatch', function( WP_REST_Response $response, WP_REST_Server $rest, WP_REST_Request $request) {
$response->header('X-WP-Nonce', wp_create_nonce( 'wp_rest' ));
return $response;
}, PHP_INT_MAX, 3);
// wp_create_nonce relies on user-id from global user object, and authentication cookie.
// both are INCORRECT after programmatic log-in or log-out.
// Really, WordPress? You should do this for us!
@un33k
un33k / nginx.conf
Last active January 17, 2023 22:36
Enable Nginx to send Content-Dispositions on specific files
server {
listen *:80;
server_name www.example.com;
rewrite ^(.*) http://example.com $1 permanent;
}
server {
listen *:80;
server_name example.com;
@luetkemj
luetkemj / wp-query-ref.php
Last active May 25, 2024 10:56
WP: Query $args
// This gist is now maintained on github at https://github.com/luetkemj/wp-query-ref
<?php
/**
* WordPress Query Comprehensive Reference
* Compiled by luetkemj - luetkemj.github.io
*
* CODEX: http://codex.wordpress.org/Class_Reference/WP_Query#Parameters
* Source: https://core.trac.wordpress.org/browser/tags/4.9.4/src/wp-includes/query.php
*/
@ScottPhillips
ScottPhillips / .htaccess
Created February 2, 2012 04:30
Common .htaccess Redirects
#301 Redirects for .htaccess
#Redirect a single page:
Redirect 301 /pagename.php http://www.domain.com/pagename.html
#Redirect an entire site:
Redirect 301 / http://www.domain.com/
#Redirect an entire site to a sub folder
Redirect 301 / http://www.domain.com/subfolder/