Skip to content

Instantly share code, notes, and snippets.

View kraftner's full-sized avatar

Thomas Kräftner kraftner

View GitHub Profile

1. Download your Twitter archive

You can find this feature in Settings > Download Twitter Archive. It might take 24 hours to receive. Unzip the file and open the data folder in your terminal:

cd ~/Downloads/twitter-archive-zip-you-downloaded/data

(I have seen reports that this function may no longer be working, so this guide is mostly useful to those who were lucky enough to already have downloaded their archive.)

@robgeorgeuk
robgeorgeuk / Codeception-setup.md
Last active November 29, 2021 13:02
Setup notes for Codeception, Selenium, Chromedriver and Visualception
<?php
/*
ACF - even when used with json/php files only, has the problem that it triggers a wpquery
that does not scale if you reach a certain amount of wp_post's.
to bypass this, we hook into posts_pre_query and disable the ACF lookup that is slow.
this DISABLES to ability to use DB stored acf settings, you'd need to load the json/php files.
to provide a little bit better DEV-XP - you can bypass this bypass :D - with WP_DEBUG=true
*/
add_filter('posts_pre_query', array( $this, 'acf_posts_pre_query' ), 15, 2);
@sgomes
sgomes / functions.scss
Last active September 27, 2022 12:36
[Using Sass to automatically pick text colors] #4 - step 2
/**
* Calculate the luminance for a color.
* See https://www.w3.org/TR/WCAG20-TECHS/G17.html#G17-tests
*/
@function luminance($color) {
$red: nth($linear-channel-values, red($color) + 1);
$green: nth($linear-channel-values, green($color) + 1);
$blue: nth($linear-channel-values, blue($color) + 1);
@return .2126 * $red + .7152 * $green + .0722 * $blue;
@Rarst
Rarst / RoboFile.php
Last active December 1, 2019 19:41
Robo command to build a release zip for Composer package.
<?php
class RoboFile extends \Robo\Tasks {
/**
* Creates release zip
*
* @param string $package Composer package in vendor/name format.
* @param string $version Version to build.
*/
@tomjn
tomjn / readme.md
Last active March 19, 2016 00:38
Copy paste into the terminal on OS X to download and install everything needed for VVV, then create a VVV vagrant box in ~/vvv

Open the "Terminal" application in MacOS X, then copy paste the script and press enter. It will install VVV and all its dependencies.

It will also install an additional site that will show how to add your own sites ( site-name.dev ).

When finished, it will do several things:

  • Open your www folder in Finder for editing
  • Open the VVV webpage for information
  • Open the CFTP Site init scaffold with information on how to add your own sites
@swissspidy
swissspidy / language-updates-table.php
Last active April 4, 2020 11:20
Display a table with available translation updates on the WordPress update screen
<?php
/**
* Plugin Name: Translation Updates Table
*
* @author Pascal Birchler <pascal@required.ch>
* @license GPL2+
*/
/**
* Displays a table with available translation updates.
@Rarst
Rarst / doge.php
Last active December 27, 2019 10:34
Doge snippet for WordPress
<?php
add_filter('gettext',fn($t)=>
@$t[4]&&@$GLOBALS['wp_locale']
?["Such $t","Very $t",'Wow'][rand(0,2)]
:$t);
INITIALISATION
==============
load wp-config.php
set up default constants
load wp-content/advanced-cache.php if it exists
load wp-content/db.php if it exists
connect to mysql, select db
load object cache (object-cache.php if it exists, or wp-include/cache.php if not)
load wp-content/sunrise.php if it exists (multisite only)
@thefuxia
thefuxia / mlp-addon-post-meta.php
Last active November 26, 2015 09:00
MLP Addon: Sync post meta fields
<?php # -*- coding: utf-8 -*-
/**
* Plugin Name: MLP Addon: Sync post meta fields
* Plugin URI: https://gist.github.com/toscho/6393c79aacba0983a96a
* Description: Create a custom field, put it into the MLP translation box, and sync it across the sites.
* Version: 2015.03.03
* Required: 4.0
* Author: Thomas Scholz <info@toscho.de>
* Author URI: http://toscho.de
* License: MIT