Skip to content

Instantly share code, notes, and snippets.


Gustaf Lindqvist gustaflindqvist

View GitHub Profile
grapefrukt / CornerCheat.cs
Created Apr 7, 2021
Makes a CircleCollider2D slide smoothly along the inner edge of a rounded EdgeCollider2D
View CornerCheat.cs
using UnityEngine;
public class CornerCheat : MonoBehaviour {
public CircleCollider2D circle;
public Rigidbody2D body;
EdgeCollider2D edge;
[Range(0, .2f)] public float distanceThreshold = .03f;
[Range(0, 1)] public float dotThreshold = .96f;
phi-lira / UniversalPipelineTemplateShader.shader
Last active Apr 12, 2021
Template shader to use as guide to create Universal Pipeline ready shaders. This shader works with Universal Render Pipeline 7.1.x and above.
View UniversalPipelineTemplateShader.shader
// When creating shaders for Universal Render Pipeline you can you the ShaderGraph which is super AWESOME!
// However, if you want to author shaders in shading language you can use this teamplate as a base.
// Please note, this shader does not necessarily match perfomance of the built-in URP Lit shader.
// This shader works with URP 7.1.x and above
Shader "Universal Render Pipeline/Custom/Physically Based Example"
// Specular vs Metallic workflow
[HideInInspector] _WorkflowMode("WorkflowMode", Float) = 1.0
bwbaugh /
Created Aug 20, 2016
Installing Ubiquiti UniFi Controller 5 on Raspberry Pi.
# Mirror of the instructions available here:
# These commands CANNOT be run in a script.
# They're just for reference.
# Install on Raspbian Jessie, or upgrade from Wheezy.
# Make sure all packages are upgraded (update && upgrade).
kburdett /
Last active Feb 20, 2021
Install Ubiquiti's UniFi Controller on a Raspberry Pi


I currently run Ubiquiti's UniFi Controller on a Raspberry Pi 3B without issue. I have tried with a Raspberry Pi 1B, but the application crashes on startup. I assume it is due to a lack of RAM. Presumably, it would run on a Raspberry Pi 2B as well (same amount of RAM), but I have not tested it on this model. YMMV.


  1. Install Raspbian on a SD card. I tested this with Jessie Lite (headless)

  2. Use raspi-config to expand the filesystem, rename your PI, etc

tbranyen /
Last active Apr 13, 2021
OpenWeatherMap / Weather Icons integration
  1. Include Weather Icons in your app:

  2. Include the below JSON in your application, for example purposes, lets assume it's a global named weatherIcons.

  3. Make a request to OpenWeatherMap:

req = $.getJSON(',uk&callback=?');
ptz0n / _respond.scss
Created Jul 22, 2012
Sass respond to mixin
View _respond.scss
@mixin respond-to($media) {
@if $media == landscape {
@media screen and (min-width: 321px) { @content; }
@else if $media == tablet {
@media only screen and (min-width: 768px) { @content; }
@else if $media == desktop {
@media only screen and (min-width: 992px) { @content; }
lindblom / sv.yml
Created Jul 10, 2012
Svensk översättning av distance_in_words för rails
View sv.yml
# Det måste vara en tom rad här av någon anledning :)
default: "%Y-%m-%d"
short: "%b %d"
long: "%B %d, %Y"
day_names: [Söndag, Måndag, Tisdag, Onsdag, Torsdag, Fredag, Lördag]
abbr_day_names: [Sön, Mån, Tis, Ons, Tors, Fre, Lör]
langalex /
Created Jun 15, 2012
Logging in to the hotel wifi at Nordic Ruby 2012
# take one of the wifi cards from the bar and fill in the blanks
# this wil log you into the hotel wifi without having to type in the username/password every time
curl -XPOST -d "username=<username>&password=<password>&"
brookr / gist:2493622
Created Apr 25, 2012 — forked from derekharmel/gist:2399684
How to fix pow not using the correct gemset
View gist:2493622
# From the project root
rvm env -- `rvm current` >> .powenv
spalladino / can_destroy.rb
Created Jan 31, 2012
How to check if object can be destroyed if it has dependent restrict associations
View can_destroy.rb
class ActiveRecord::Base
def can_destroy?
self.class.reflect_on_all_associations.all? do |assoc|
assoc.options[:dependent] != :restrict || (assoc.macro == :has_one && self.send( || (assoc.macro == :has_many && self.send(