Skip to content

Instantly share code, notes, and snippets.

View levilansing's full-sized avatar

Levi Lansing levilansing

View GitHub Profile
using System.Collections.Generic;
using UnityEngine;
public static class ColliderTwiddler {
static List<Collider> colliders = new();
/**
* This is a hack to force the colliders to trigger OnTriggerEnter/etc.
* Call this after instantiating an object or adding a rigidbody to it.
*/
@levilansing
levilansing / mov2gif.sh
Created September 2, 2020 19:49
Bash script to convert mov screen recordings to gifs
#!/bin/sh
if [ -z $1 ]
then
echo 'Usage: mov2gif [50%] [15fps] source_file [destination_file]'
exit 1
fi
scale=1
scale_pat='^[0-9]+%$'
[
["f", "Show next/latest diffs", "setProposedDiffBounds()"],
["n", "Next unreviewed file", "nextUnreviewedFile()"],
["p", "Previous unreviewed file", "prevUnreviewedFile()"],
["shift+n", "Next changed file", "nextChangedFile()"],
["shift+p", "Previous changed file", "prevChangedFile()"],
[null, "Next visible file", "nextVisibleFile()"],
[null, "Previous visible file", "prevVisibleFile()"],
[null, "Next file", "nextFile()"],
@levilansing
levilansing / FixProBuilderPivot.cs
Created February 6, 2018 04:13
Unity3d Editor script to put pivot point in ProBuilder objects back on the mesh after manipulating the faces/edges/verts
/* Fix ProBuilder Pivot
* An action to move the pivot back to the mesh in cases where you've
* manipulated the edges/faces of a mesh and left the pivot far behind
* Author: Levi Lansing (https://github.com/levilansing)
* Feb 2018
*/
using UnityEngine;
using UnityEditor;
using ProBuilder2.Common;
@levilansing
levilansing / gist:8fc033918d26684ece08a3f126ee0743
Created June 29, 2017 03:01
Change YouTube Playback Speed
// increase YouTube video playback speed beyond UI limitations of 2x
document.getElementsByTagName("video")[0].playbackRate = 2.5;
@levilansing
levilansing / README.md
Last active March 6, 2017 10:18 — forked from jocki84/README.md
scrollIntoViewIfNeeded 4 everyone!!!

Polyfill for scrollIntoViewIfNeeded()

This gist provides polyfill code for the scrollIntoViewIfNeeded() Element method found on WebKit browsers.

Features

There is no particular requirement on the position in the hierarchy of the element being made visible with respect to any scrollable areas. Elements that are relatively positioned as well as nested scrollable areas are both supported.

CoffeeScript version added with an optional offset for scrolling past fixed headers, etc