Navigation Menu

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 / FlyCamera.cs
Created January 27, 2023 12:49 — forked from FreyaHolmer/FlyCamera.cs
A camera controller for easily flying around a scene in Unity smoothly. WASD for lateral movement, Space & Ctrl for vertical movement, Shift to move faster. Add this script to an existing camera, or an empty game object, hit play, and you're ready to go~
using UnityEngine;
[RequireComponent( typeof(Camera) )]
public class FlyCamera : MonoBehaviour {
public float acceleration = 50; // how fast you accelerate
public float accSprintMultiplier = 4; // how much faster you go when "sprinting"
public float lookSensitivity = 1; // mouse look sensitivity
public float dampingCoefficient = 5; // how quickly you break to a halt after you stop your input
public bool focusOnEnable = true; // whether or not to focus and lock cursor immediately on enable
@yratof
yratof / extended_Filterable_Portfolio.php
Created November 21, 2022 21:20
Adding excerpts to Filterable_Portfolio in DIVI
<?php
class Extra_ET_Builder_Module_Filterable_Portfolio extends ET_Builder_Module_Filterable_Portfolio {
function init() {
$this->name = esc_html__( 'Filterable Portfolio', 'et_builder' );
$this->plural = esc_html__( 'Filterable Portfolios', 'et_builder' );
$this->slug = 'et_pb_filterable_portfolio';
$this->vb_support = 'off';
$this->main_css_element = '%%order_class%%.et_pb_filterable_portfolio';
@yratof
yratof / divi-viewport-pinch-to-zoom.php
Created November 1, 2022 19:27 — forked from Garconis/divi-viewport-pinch-to-zoom.php
Divi | Add pinch and zoom (user scalable) to mobile viewport meta
<?php
// Removes et_add_viewport_meta from the wp_head phase
function remove_divi_actions() {
remove_action( 'wp_head', 'et_add_viewport_meta' );
}
// Call 'remove_divi_actions' during WP initialization
add_action('init','remove_divi_actions');
// add ability to pinch and zoom
@yratof
yratof / vanilla.js
Last active September 7, 2022 22:33
Toggle class with ES6 vanilla
// The element you're targetting
// The class you're toggling
const el = document.querySelector('.menu-item-has-children');
const handleToggle = () => el.classList.toggle('available');
el.onclick = () => handleToggle();
document.addEventListener('click', event => {
const isClickInside = el.contains(event.target)
if (!isClickInside) {
@yratof
yratof / morphagene_ableton.py
Created January 12, 2022 22:32 — forked from knandersen/morphagene_ableton.py
Allows you to use Ableton projects and exports as reels for the Make Noise Morphagene eurorack module.
#!/usr/bin/env python2
# -*- coding: utf-8 -*-
"""
USAGE:
morphagene_ableton.py -w <inputwavfile> -l <inputlabels> -o <outputfile>'
Instructions in Ableton:
Insert locators as splice markers in your project (Create > Add Locator)
Export Audio/Video with
Sample Rate: 48000 Hz
@yratof
yratof / brew-cleanup.sh
Created October 26, 2021 07:54
Brew permission fixer
# https://stackoverflow.com/questions/16432071/how-to-fix-homebrew-permissions
sudo chown -R "$USER":admin 'path-to-thing-brew-complains-about'
@yratof
yratof / ae_wiggle_posterise.js
Created October 14, 2021 11:27
After effects posterise wiggle
f = 2; // Freq
a = 10; // Amount
posterizeTime(f); // Posterise it
wiggle(f, a); // Wiggle that
@yratof
yratof / mm_HeightToNormal.osl
Last active August 28, 2022 10:06
OTOY Octane Height_To_Normal.OSL
#include <octane-oslintrin.h>
// IMPORTANT: Make sure the input
// is using OSL delayed UV projection.
//
// This shader will convert a height map to a tangent normal map
// based on the average value, luminance or intensity of one of the RGB channels.
//
// If you need many of these nodes with Quality set to High,
// please consider using the baking texture node.
@yratof
yratof / dbngin.sh
Created October 7, 2021 08:42
Avoiding socket error with dbngin
# Futher info here: https://github.com/TablePlus/DBngin/issues/38
mysql --socket /tmp/mysql_3306.sock -uroot
@yratof
yratof / scripts.php
Created September 1, 2021 12:08
Add scripts to customizer for wordpress
<?php
/* Customiser script */
add_action( 'customize_register', 'custom_editor' );
function custom_editor( $wp_customize ) {
// Analytics section
$wp_customize->add_section('analytics_section', array(
'title' => __( 'Analytics', 'tuesday' ),
'description' => __( 'Enable tracking and analytics by placing your script tags in the correct location. <small><strong>Note:</strong> All scripts must be self-containing &lt;script&gt;&lt;/script&gt;, otherwise they will just print the code onto the website.</small>', 'tuesday' ),