Skip to content

Instantly share code, notes, and snippets.

View yratof's full-sized avatar
🍊
Eating an orange

Andrew yratof

🍊
Eating an orange
View GitHub Profile
@yratof
yratof / class-craft-images.php
Last active February 15, 2018 13:51
Call the featured image with an SVG fallback for featured image
<?php
class drivkraft_load {
/**
* Output featured image with SVG placeholder
* @return html
*/
static function featured_image( $post_id = null, $size = 'medium', $colour = '#f3f3f3' ) {
global $post;
@yratof
yratof / customiser.php
Created November 29, 2017 09:24
Basic wordpress customizer functions to change the content & see the changes as they happen
<?php
add_action( 'customize_register', __CLASS__ . '::custom_content_area' );
function custom_content_area( $wp_customize ) {
$wp_customize->add_section('custom_content_area_section', array(
'title' => __( 'Content area', 'wordpress' ),
'description' => __( 'Globally change the content area', 'wordpress' ),
@yratof
yratof / gist:779cb04c4d238169c3b06867f7c50bc1
Created November 22, 2017 16:12 — forked from kloon/gist:4541017
WooCommerce Clear Cart via URL
// check for clear-cart get param to clear the cart, append ?clear-cart to any site url to trigger this
add_action( 'init', 'woocommerce_clear_cart_url' );
function woocommerce_clear_cart_url() {
if ( isset( $_GET['clear-cart'] ) ) {
global $woocommerce;
$woocommerce->cart->empty_cart();
}
}
@yratof
yratof / wp.sh
Created November 20, 2017 14:56
Delete transients for all sites on a multisite
wp site list --field=url | xargs -n1 -I % wp --url=% transient delete-all
@yratof
yratof / customiser.php
Created September 28, 2017 09:54
Range for customiser
<?php
/**
* Create a range slider for the Customiser
*/
if ( class_exists( 'WP_Customize_Control' ) ) {
class WP_Customize_Range extends WP_Customize_Control {
public $type = 'range';

Night browsing. That stage where i'm ready for bed. I'm just not yet sure that i've consumed enough information to think about while I sleep. It's at this time that I start seeing things. Weird things. In fact, I don't see anything, my mind does. And it's not to the level of "Oh shit, do I believe what I just saw", it's more to the tune of "I wonder what would happen if I saw".

So what did I see?

We have windows that look out into a fjord.

@yratof
yratof / indicators.html
Last active August 16, 2017 08:55
Micro:bit indicators
<div style="position:relative;height:0;padding-bottom:81.97%;overflow:hidden;"><iframe style="position:absolute;top:0;left:0;width:100%;height:100%;" src="https://makecode.microbit.org/---run?id=_ge6P01606H3x" allowfullscreen="allowfullscreen" sandbox="allow-popups allow-forms allow-scripts allow-same-origin" frameborder="0"></iframe></div>
@yratof
yratof / serial_key.py
Created August 15, 2017 15:39
Micro:bit python serial that listens using pyautogui
"""Serial-Key, Keyboard emulator reading on a serial port
Usage:
python {__file__} [-h|--help] [port [baud rate]]
The program will automatically try to detect a port where a micro:bit is
connected. If unsuccessful, it is possible to explicitly specify a port on the
command line. For example
python {__file__} {serial_ports_list[0]}
@yratof
yratof / ToonDeferredShading2017.shader
Created July 5, 2017 13:43 — forked from xDavidLeon/ToonDeferredShading2017.shader
Unity 5.6 Deferred Cel Shading Modification
// Unity built-in shader source. Copyright (c) 2016 Unity Technologies. MIT license (see license.txt)
// Modifications by David Leon. Copyright (c) 2017 Lince Works SL. MIT license (see license.txt)
Shader "ToonDeferredShading2017" {
Properties {
_LightTexture0 ("", any) = "" {}
_LightTextureB0 ("", 2D) = "" {}
_ShadowMapTexture ("", any) = "" {}
_SrcBlend ("", Float) = 1
_DstBlend ("", Float) = 1
<img src="https://unsplash.it/1200/600?random&3" alt="Example image" />
<h2>Accelerator Accelerator</h2>
<p>Technology bandwidth supply chain long tail. Accelerator angel investor value proposition Accelerator web design. Rockstar churn rate early adopters series A financing stealth facebook success beta product management non-disclosure agreement. Long tail research & development deployment lean startup advisor series A financing focus innovator iPad. IPad launch party network effects equity backing strategy first mover advantage partnership hackathon. Buyer gamification innovator low hanging fruit technology business-to-consumer pitch non-disclosure agreement seed round burn rate virality. Stock startup user experience metrics leverage direct mailing. Burn rate buyer business plan network effects crowdfunding product management iPhone sales advisor hackathon iPad buzz business-to-business churn rate. Partner network early adopters termsheet advisor customer success niche market investor stealth agile deve