Skip to content

Instantly share code, notes, and snippets.

@tattyd
tattyd / Shadow.cs
Last active June 23, 2024 21:17
Soft shadow control for Unity UI Toolkit
/* MIT License
Copyright (c) 2022 David Tattersall
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
@ArminJo
ArminJo / bresenhamThickLine.cpp
Last active March 30, 2023 20:15
Draw a solid line with thickness using a modified Bresenhams algorithm.
/*
* Overlap means drawing additional pixel when changing minor direction
* Needed for drawThickLine, otherwise some pixels will be missing in the thick line
*/
#define LINE_OVERLAP_NONE 0 // No line overlap, like in standard Bresenham
#define LINE_OVERLAP_MAJOR 0x01 // Overlap - first go major then minor direction. Pixel is drawn as extension after actual line
#define LINE_OVERLAP_MINOR 0x02 // Overlap - first go minor then major direction. Pixel is drawn as extension before next line
#define LINE_OVERLAP_BOTH 0x03 // Overlap - both
#define LINE_THICKNESS_MIDDLE 0 // Start point is on the line at center of the thick line
using UnityEngine;
using System.Collections;
public class ShakeTransformS : MonoBehaviour
{
[Header("Info")]
private Vector3 _startPos;
private float _timer;
private Vector3 _randomPos;
@zmts
zmts / docker.md
Last active May 19, 2024 14:47
Docker, TypeScript, Node.js

Docker, TypeScript, Node.js

Preconditions:

  • TS application listening port: 7777
|-- dist
|-- src
|-- .dockerignore
|-- Dockerfile
@marcandreappel
marcandreappel / Xdebug_Valet_PHPStorm.md
Last active December 9, 2023 01:16
Xdebug on Valet with PHPStorm

Xdebug on Valet with PHPStorm

Installation

Install homebrew → https://brew.sh

Install beforehand NginX, MariaDB, DnsMasq and PHP7.2 with Composer

$ brew install php nginx mariadb dnsmasq composer
@robhrt7
robhrt7 / MySQL_5-7_macOS.md
Last active February 28, 2024 03:48 — forked from nrollr/MySQL_macOS_Sierra.md
Install MySQL 5.7 on macOS using Homebrew

This is a fork of original gist https://gist.github.com/nrollr/3f57fc15ded7dddddcc4e82fe137b58e, with slight changes on pointing to 5.7 version branch, instead of 8 (latest default of MySQL in Hombrew).

Install MySQL 5.7 on macOS

This procedure explains how to install MySQL using Homebrew on macOS (Sierra 10.12 and up)

Install Homebrew

  • Installing Homebrew is effortless, open Terminal and enter :
    $ /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
  • Note: Homebrew will download and install Command Line Tools for Xcode 8.0 as part of the installation process.
@navjotdhanawat
navjotdhanawat / json-to-s3.js
Created July 3, 2018 07:17
Create json and upload to s3 bucket using nodejs.
var AWS = require('aws-sdk');
AWS.config.update({ region: 'us-east-1' });
var s3 = new AWS.S3();
var obj = {
firstname: "Navjot",
lastname: "Dhanawat"
};
var buf = Buffer.from(JSON.stringify(obj));
@Templar2020
Templar2020 / Wander.cs
Created March 29, 2018 17:13
Unity Nav Mesh Wander Script
using UnityEngine;
using System.Collections;
public class Wander : MonoBehaviour {
public float wanderRadius;
public float wanderTimer;
private Transform target;
private NavMeshAgent agent;

If .DS_Store was never added to your git repository, simply add it to your .gitignore file.

If you don't have one, create a file called

.gitignore

In your the root directory of your app and simply write

@bellicapax
bellicapax / SerializableDictionary.cs
Last active February 23, 2023 21:35
Serializable Dictionary base for Unity
using UnityEngine;
namespace System.Collections.Generic
{
[Serializable]
public abstract class SerializableDictionary<TKey, TValue> : Dictionary<TKey, TValue>, ISerializationCallbackReceiver
{
protected abstract List<SerializableKeyValuePair<TKey, TValue>> _keyValuePairs { get; set; }
// save the dictionary to lists