Skip to content

Instantly share code, notes, and snippets.

View codeimpossible's full-sized avatar
🍕
P I Z Z A

Jared Barboza codeimpossible

🍕
P I Z Z A
View GitHub Profile
@Donnotron666
Donnotron666 / EmissiveSpriteShaderClamped.shader
Last active May 15, 2019 03:06
A sprite shader with emission clamping. The EmissionClamping values keep the shader from creating emission under certain thresholds, so a texture of mostly dark colors with a few bright highlights can be kept as a single game sprite.
Shader "Sprites/EmissiveSpriteShaderClamped"
{
Properties
{
[PerRendererData] _MainTex("Sprite Texture", 2D) = "white" {}
_SelfIllum("Self Illumination",Range(0.0,1.0)) = 0.0
_FlashAmount("Flash Amount",Range(0.0,1.0)) = 0.0
_Color("Tint", Color) = (1,1,1,1)
[MaterialToggle] PixelSnap("Pixel snap", Float) = 0
_EmissionMap("Emission Map", 2D) = "black"{}
Shader "Sprites/EmissiveSpriteShader"
{
Properties
{
[PerRendererData] _MainTex("Sprite Texture", 2D) = "white" {}
_SelfIllum("Self Illumination",Range(0.0,1.0)) = 0.0
_FlashAmount("Flash Amount",Range(0.0,1.0)) = 0.0
[PerRendererData] _Color("Tint", Color) = (1,1,1,1)
[MaterialToggle] PixelSnap("Pixel snap", Float) = 0
_EmissionMap("Emission Map", 2D) = "black"{}
@michidk
michidk / OutlineShader.shader
Last active April 8, 2024 01:06
An outline shader made for Unity with the help of @OverlandGame. It adjusts the size of the outline to automatically accomodate screen width and camera distance.
// An outline shader made for Unity with the help of @OverlandGame by @miichidk
// It adjusts the size of the outline to automatically accomodate screen width and camera distance.
// See how it looks here: https://twitter.com/OverlandGame/status/791035637583388672
// How to use: Create a material which uses this shader, and apply this material to any meshrenderer as second material.
Shader "OutlineShader"
{
Properties
{
_Width ("Width", Float ) = 1
_Color ("Color", Color) = (1,1,1,1)
/*
Basic Sprite Shader for aligning pixel art to the same grid, based on the Unity Sprite Shader.
Create one Material where you assign the same Pixels Per Unit value you use on your imported Sprites,
then reuse this Material on all appropriate Sprite Renderers.
(You can use Shader.SetGlobalFloat to set that Pixels Per Unit value for all your shaders:
https://docs.unity3d.com/ScriptReference/Shader.SetGlobalFloat.html)
This is not for scaled or rotated artwork. If you need those features, look at low res render textures.
Use this however you want.
anonymous
anonymous / jsbin.IXALOP.css
Created September 17, 2013 12:22
#content {
padding-top: 20px;
}
i[class^="icon-"].large {
font-size: 64px;
}
.text-right {
text-align: right;
@dergachev
dergachev / GIF-Screencast-OSX.md
Last active May 2, 2024 05:55
OS X Screencast to animated GIF

OS X Screencast to animated GIF

This gist shows how to create a GIF screencast using only free OS X tools: QuickTime, ffmpeg, and gifsicle.

Screencapture GIF

Instructions

To capture the video (filesize: 19MB), using the free "QuickTime Player" application:

@jbubriski
jbubriski / gist:3516037
Created August 29, 2012 17:40
Ship Acceleration and Velocity
public float Acceleration { get; set; }
public void Update(GameTime gameTime)
{
var additionalVelocity = new Vector2((float)Mat.Cos(Rotation) * Acceleration, (float)Math.Sin(Rotation) * Acceleration);
var newVelocity = CurrentVelocity + additionalVelocity;
if (Math.Abs(newVelocity.DistanceTo(Vector2.Zero)) <= 250)
{
@jlong
jlong / uri.js
Created April 20, 2012 13:29
URI Parsing with Javascript
var parser = document.createElement('a');
parser.href = "http://example.com:3000/pathname/?search=test#hash";
parser.protocol; // => "http:"
parser.hostname; // => "example.com"
parser.port; // => "3000"
parser.pathname; // => "/pathname/"
parser.search; // => "?search=test"
parser.hash; // => "#hash"
parser.host; // => "example.com:3000"
$dontcare = git fetch origin --prune
$branches = git branch -a --merged |
?{$_ -match "remotes\/origin"} |
?{$_ -notmatch "\/master"} |
%{$_.Replace("remotes/origin/", "").Trim() }
if (-not $branches) {
echo "No merged branches detected"
exit 0
}
@codeimpossible
codeimpossible / MassiveFluently.cs
Created January 6, 2012 18:10
Massive Fluently rough draft
using System;
using System.Dynamic;
using Massive;
namespace MassiveFluently.Expressions {
public class All {}
public class First {}
public class Last {}
}
namespace MassiveFluently {