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 / rotation.js
Created May 18, 2017 20:01
After Effects – Rotation based on two nulls
A = thisComp.layer("yratof_1_2017-10-09_0051_C0008.mov").effect( "Face Track Points" )( "Mouth Right" );
B = thisComp.layer("yratof_1_2017-10-09_0051_C0008.mov").effect( "Face Track Points" )( "Mouth Left" );
SideA = sub(A, B)[1];
SideB = sub(A, B)[0];
radiansToDegrees(Math.atan2(SideA, SideB)) + 180;
@yratof
yratof / script.js
Created May 11, 2017 11:11
Slick slider for slides with titles
jQuery(document).ready(function ($) {
$('.slider-for').slick({
slidesToShow: 1,
slidesToScroll: 1,
arrows: false,
fade: true,
asNavFor: '.slider-nav',
autoplay: true
@yratof
yratof / print.json
Created April 6, 2017 15:25
3D Printer settings
{
"printer_type_id": "26",
"layer_height": "0.2",
"wall_thickness": "0.8",
"nozzle_size": "0.4",
"bottom_thickness": "0.2",
"filament_diameter": "1.75",
"filament_flow": "120",
"solid_top": "1",
"solid_bottom": "1",
@yratof
yratof / function.better-renaming.php
Last active February 15, 2018 13:59
Consistent naming of image sizes with Wordpress
<?php
class image_renaming {
// The filter runs when resizing an image to make a thumbnail or intermediate size.
static function image_renaming(){
add_filter( 'image_make_intermediate_size', __CLASS__ . '::wpse_123240_rename_intermediates' );
}
static function wpse_123240_rename_intermediates( $image ) {
@yratof
yratof / functions.php
Created March 23, 2017 10:02
Filter ACF post_object by taxonomy when on taxonomy page
<?php
class acf_filter_post_object {
static function setup() {
add_filter( 'acf/fields/post_object/query/name=FIELD_NAME', __CLASS__ . '::only_current_terms', 10, 3 );
}
/*
Only current terms to be shown within the taxonomy
@yratof
yratof / class-woocommerce-order-status.php
Last active August 13, 2020 18:15
Custom order status for Woocommerce
<?php
class order_status_customisation {
/**
* Setup actions
*/
static function setup() {
add_action( 'init', __CLASS__ . '::adding_additional_order_statuses', 10 );
add_filter( 'wc_order_statuses', __CLASS__ . '::add_awaiting_shipment_to_order_statuses', 10, 1 );
@yratof
yratof / microbit.js
Created December 22, 2016 21:46
Bike indicators for Micro:bit
input.onButtonPressed(Button.A, () => {
radio.sendNumber(0)
for (let i = 0; i < 10; i++) {
basic.showLeds(`
. . # . .
. # . . .
# # # # #
. # . . .
. . # . .
`)
@yratof
yratof / failed.js
Created December 19, 2016 16:48
Failed iamges in JS
function imgLoaded(imgElement) {
return imgElement.complete && imgElement.naturalHeight !== 0;
}
$ = jQuery;
$('img').each( function(){
if ( ! imgLoaded( $(this) ) ) {
$(this).addClass('failed');
}});
@yratof
yratof / windows.sh
Created December 18, 2016 01:21
Fix HDD to install Windows 10
#Shift + f10
Diskpart
List Disk
Select Disk (and whatever number disk you want to change)
Clean
Convert GPT
@yratof
yratof / grid.scss
Created December 15, 2016 22:28
Using @span for grid
&.columns{
/* Layout options */
@for $i from 2 through 8 {
&-#{$i}{
$value: 12 / $i;
.grid__image--item {
@include span( $value, 12 );
&:nth-of-type(#{$i}n+#{$i}){
margin-right: 0;
}