Skip to content

Instantly share code, notes, and snippets.

View levilansing's full-sized avatar

Levi Lansing levilansing

View GitHub Profile
@RodGreen
RodGreen / SwitchShortcutsProfileOnPlay.cs
Created September 12, 2019 21:54
Automatically switches editor shortcut profile when playing Unity3D
using UnityEngine;
using UnityEditor;
using UnityEditor.ShortcutManagement;
using System.Linq;
[InitializeOnLoad]
public class SwitchShortcutsProfileOnPlay
{
private const string PlayingProfileId = "Playing";
private static string _activeProfileId;
@tdbe
tdbe / BakeryLightmapManager.cs
Last active August 27, 2022 19:00
A lightmap manager for the Bakery lightmapper from the unity asset store. You can now swap between multiple versions of your lightmaps, and combine different bakes from different lightmap groups.
/// <summary>
/// Author: tudor, https://github.com/tdbe
/// You found this gist at: https://gist.github.com/tdbe/e3c41e6a2dedd88dad907218126a2c39
///
/// This is free and unencumbered software released into the public domain.
//
// Anyone is free to copy, modify, publish, use, compile, sell, or
// distribute this software, either in source code form or as a compiled
// binary, for any purpose, commercial or non-commercial, and by any
// means.
@magnetikonline
magnetikonline / README.md
Last active June 19, 2024 00:00
List all Git repository objects by size.

List all Git repository objects by size

Summary

Bash script which will:

  • Iterate all commits made within a Git repository.
@Naphier
Naphier / UGuiTextToTextMeshPro.cs
Created January 4, 2017 15:23
Unity3D Editor Tool to convert Unity GUI Text objects to Text Mesh Pro Text Objects
using UnityEngine;
using UnityEditor;
using UnityEngine.UI;
using TMPro;
using TMPro.EditorUtilities;
public class UGuiTextToTextMeshPro : Editor
{
[MenuItem("GameObject/UI/Convert To Text Mesh Pro", false, 4000)]
static void DoIt()
@sobstel
sobstel / nokogiri_install
Created January 3, 2017 17:30
nokogiri -> ERROR: cannot discover where libxml2 is located on your system
# `ERROR: Error installing nokogiri:
# ERROR: Failed to build gem native extension.
#
# current directory: /usr/local/var/rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/nokogiri-1.7.0/ext/nokogiri
# /usr/local/var/rbenv/versions/2.3.1/bin/ruby -r ./siteconf20170103-68488-r71c9j.rb extconf.rb --with-xml=/usr/local/Cellar/libxml2/ --use-system-libraries
# checking if the C compiler accepts ... yes
# checking if the C compiler accepts -Wno-error=unused-command-line-argument-hard-error-in-future... no
# Building nokogiri using system libraries.
# ERROR: cannot discover where libxml2 is located on your system. please make sure `pkg-config` is installed.
# *** extconf.rb failed ***
@enghqii
enghqii / NormalMap.shader
Created December 12, 2015 02:23
NormalMap shader Unity
Shader "Custom/NormalMapShader" {
Properties {
_Color ("Color", Color) = (1,1,1,1)
_LightColor("LightColor", Color) = (1,1,1,1)
_MainTex("Albedo (RGB)", 2D) = "white" {}
_SpecularMap("SpecularMap (RGB)", 2D) = "white" {}
_NormalMap("NormalMap", 2D) = "white" {}
_MainLightPosition("MainLightPosition", Vector) = (0,0,0,0)
}
SubShader{
@msealand
msealand / CGVectorUtilities.swift
Last active September 4, 2019 17:37
Operator overloads to do scalar vector math on CGPoint, CGSize, CGVector.
import CoreGraphics
protocol VectorType {
typealias Element
var xElement: Element { get }
var yElement: Element { get }
class func buildFrom(#x: Element, y: Element) -> Self
@lopopolo
lopopolo / gist:9427762
Created March 8, 2014 09:19
Relink all homebrew formulae after Mavericks upgrade
▶ brew list -1 | while read line; do brew unlink $line; brew link $line; done
Unlinking /usr/local/Cellar/appledoc/2.2... 0 links removed
Linking /usr/local/Cellar/appledoc/2.2... 1 symlinks created
Unlinking /usr/local/Cellar/autoconf/2.69... 0 links removed
Linking /usr/local/Cellar/autoconf/2.69... 18 symlinks created
Unlinking /usr/local/Cellar/bash-completion/1.3... 184 links removed
Linking /usr/local/Cellar/bash-completion/1.3... 182 symlinks created
Unlinking /usr/local/Cellar/bgrep/0.2... 0 links removed
Linking /usr/local/Cellar/bgrep/0.2... 1 symlinks created
Unlinking /usr/local/Cellar/binutils/2.24... 49 links removed
@kryptykphysh
kryptykphysh / logger.rb
Last active October 10, 2016 16:45
Ruby: Logging module with class names, output to both STDOUT and file
require 'logger'
module Logging
class MultiDelegator
def initialize(*targets)
@targets = targets
end
def self.delegate(*methods)
methods.each do |m|
@ilyabo
ilyabo / index.html
Created November 17, 2011 14:29
D3 tooltip using jQuery tipsy
<!DOCTYPE html>
<html>
<head>
<script type="text/javascript" src="http://mbostock.github.com/d3/d3.js"></script>
<script type="text/javascript" src="http://code.jquery.com/jquery-1.6.2.min.js"></script>
<script type="text/javascript" src="jquery.tipsy.js"></script>
<link href="tipsy.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="chart"></div>