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
<a class="close" href="#❌">Close</a>
<a class="open" href="#open">open</a>
@yratof
yratof / wp-config.php
Created June 27, 2016 13:50
Wordpress Debug snippet
<?php
define( 'WP_DEBUG', true );
define( 'LOCAL_INSTALLATION', true );
define( 'SCRIPT_DEBUG', true );
@yratof
yratof / brands-list.php
Created June 25, 2016 17:28
Taxonomy: List all taxonomy terms by first letter groupd
<?php
static function list_brands_by_letter() {
$list = '';
$args = [ 'hide_empty' => false ];
$tags = get_terms( 'brand', $args );
$groups = [];
if ( $tags && is_array( $tags ) ) {
foreach ( $tags as $tag ) {
@yratof
yratof / acf-variations.php
Last active October 11, 2017 19:22
Woocommerce ACF to Variations
<?php
class woocommerce_acf_variations {
/**/
static function setup() {
/* Add this form to variations */
add_action( 'admin_head','acf_form_head', 20 );
add_action( 'woocommerce_product_after_variable_attributes', 'woocommerce_acf_variations::variation_field_group', 99, 3 );
add_action( 'woocommerce_product_thumbnails', 'woocommerce_acf_variations::display_thumbs', 99, 3 );
<?
/////////////////////
// slack2html
// by @levelsio
/////////////////////
//
/////////////////////
// WHAT DOES THIS DO?
/////////////////////
//
@yratof
yratof / toggle.js
Created June 14, 2016 11:14
Vanilla toggle class
document.querySelector('.open__this').addEventListener('click', function(e) {
var el = document.querySelector('.contact__info');
var className = 'js-hide__this';
if (el.classList) {
el.classList.toggle(className);
} else {
@yratof
yratof / _Instructions.md
Created June 13, 2016 12:57 — forked from genekogan/_Instructions.md
instructions for generating a style transfer animation from a video

Instructions for making a Neural-Style movie

The following instructions are for creating your own animations using the style transfer technique described by Gatys, Ecker, and Bethge, and implemented by Justin Johnson. To see an example of such an animation, see this video of Alice in Wonderland re-styled by 17 paintings.

Setting up the environment

The easiest way to set up the environment is to simply load Samim's a pre-built Terminal.com snap or use another cloud service like Amazon EC2. Unfortunately the g2.2xlarge GPU instances cost $0.99 per hour, and depending on parameters selected, it may take 10-15 minutes to produce a 512px-wide image, so it can cost $2-3 to generate 1 sec of video at 12fps.

If you do load the

@yratof
yratof / off-canvas.js
Created June 10, 2016 14:32
jQuery – Off-canvas reveal class applier
var canvas_reveal = function ( container, link_element ) {
var element_active = false;
var toggle_element = function() {
if ( element_active ) {
container
.addClass( 'closed' )
.removeClass( 'open' );
element_active = false;
}
else {
@yratof
yratof / actions.php
Last active June 9, 2016 09:48
Wordpress actions for themes and plugins
<?php
/* Place this where you need it */
function thing_location(){
do_action( 'location_of_thing' );
}
/* Make a function to hook */
function add_new_thing() {
echo 'This is a new thing';
}
@yratof
yratof / stickyfooter.scss
Created June 3, 2016 08:19
Sticky footer
/* Sticky Footer */
html.flexbox {
body {
min-height: 100vh; // At least the height of the browser
display: flex; // Flex enabled
flex-direction: column; // Verticle layout
// Push the container to the height of the browser
.container { flex: 1; } // Flex grow pushes the container to the height of the parent
}
}