/*********************************************** | |
* Copyright ? Far-Flung Creations Ltd. | |
* Author: Marius George | |
* Date: 25 October 2017 | |
* Email: [email protected] | |
* DISCLAIMER: THE SOURCE CODE IN THIS FILE IS PROVIDED ?AS IS? AND ANY EXPRESS OR IMPLIED WARRANTIES, | |
* INCLUDING THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. | |
* IN NO EVENT SHALL FAR-FLUNG CREATIONS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | |
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE | |
* GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) SUSTAINED BY YOU OR A THIRD |
// 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" | |
{ | |
Properties | |
{ | |
// Specular vs Metallic workflow | |
[HideInInspector] _WorkflowMode("WorkflowMode", Float) = 1.0 |
# use ImageMagick convert | |
# the order is important. the density argument applies to input.pdf and resize and rotate to output.pdf | |
convert -density 90 input.pdf -rotate 0.5 -attenuate 0.2 +noise Multiplicative -colorspace Gray output.pdf |
using UnityEngine; | |
public class ScriptableObjectSingleton<T> : ScriptableObject where T : ScriptableObject | |
{ | |
static T m_Instance = null; | |
public static T Instance | |
{ | |
get | |
{ | |
if (m_Instance == null) |
using UnityEngine; | |
using System.Collections; | |
using System.Collections.Generic; | |
/// <summary> | |
/// | |
/// </summary> | |
/// <remarks>Source: https://forum.unity3d.com/threads/trying-extrude-a-2d-polygon-to-create-a-mesh.102629/ </remarks> | |
[RequireComponent(typeof(MeshFilter), typeof(MeshRenderer), typeof(PolygonCollider2D))] | |
public class ExtrudeSprite : MonoBehaviour |
I've come to a point where I had to swap django's user model with a custom one, at a point when I already had users, and already had apps depending on the model. Therefore this guide is trying to provide the support that is not found in the django docs.
Django warns that this should only be done basically at the start of a project, so that the initial migration of an app includes the creation of the custom user model.
It took a while to do, and I ran into problems created by the already existing relations between other models and auth.User
.
There were good and not so good things regarding my project state, that influenced the difficulty of the job.
- My custom user also had an
id
field, that's just a usual default django id
This is a proposal for a lightning talk at the Reactive 2015 conference.
NOTE: If you like this, star ⭐ the Gist - the amount of stars decides whether it makes the cut! You could also Retweet if you want :)
JavaScript is getting async functions (or already has them if you count Babel.JS) and with them a way to finally slay the evil pyramid. This new language feature lets you write asynchronous code that almost looks synchronous, while maintaining the same semantics as promises. This lets you shed your .then and .catch boilerplate and escape those nested callbacks in favour of clean, explicit, maintainable code.
# If your test settings file doesn't import any other settings file | |
# then you can use the function directly: | |
def prevent_tests_migrate(db): | |
import django | |
from django.db import connections | |
from django.db.migrations.executor import MigrationExecutor | |
django.setup() | |
ma = MigrationExecutor(connections[db]).loader.migrated_apps | |
return dict(zip(ma, ['{a}.notmigrations'.format(a=a) for a in ma])) |
// ------------------------------------------------------------------ | |
// Fog helpers | |
// | |
// multi_compile_fog Will compile fog variants. | |
// UNITY_FOG_COORDS(texcoordindex) Declares the fog data interpolator. | |
// UNITY_TRANSFER_FOG(outputStruct,clipspacePos) Outputs fog data from the vertex shader. | |
// UNITY_APPLY_FOG(fogData,col) Applies fog to color "col". Automatically applies black fog when in forward-additive pass. | |
// Can also use UNITY_APPLY_FOG_COLOR to supply your own fog color. | |
// In case someone by accident tries to compile fog code in one of the g-buffer or shadow passes: |