Skip to content

Instantly share code, notes, and snippets.

View cuongnmx's full-sized avatar

Cuongnmx cuongnmx

View GitHub Profile
@cuongnmx
cuongnmx / BlendModes.c
Created November 12, 2020 03:21 — forked from elringus/BlendModes.c
Popular blend mode algorithms implemented in Nvidia's Cg. https://elringus.me/blend-modes-in-unity/
fixed3 Darken (fixed3 a, fixed3 b)
{
return min(a, b);
}
fixed3 Multiply (fixed3 a, fixed3 b)
{
return a * b;
}
@cuongnmx
cuongnmx / InstancePrefab.cs
Created November 12, 2020 03:07 — forked from reveriejake/InstancePrefab.cs
Simplified 'prefab' that allows you to draw thousands of objects to the screen. Many thanks to Mike from toqoz.fyi for his help in solving some issues I had. This code is Inspired by his blog from https://toqoz.fyi/thousands-of-meshes.html
using UnityEngine;
using System.Collections.Generic;
using UnityEngine.Rendering;
namespace PicoGames.Prototype
{
[System.Serializable]
public class InstancePrefab
{
public GameObject prefab;
@cuongnmx
cuongnmx / MeshBuffer.cs
Created November 12, 2020 02:21 — forked from reveriejake/MeshBuffer.cs
Pico Games - Unity MeshBuffer Class
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
namespace PicoGames.Common
{
[ExecuteInEditMode]
[RequireComponent(typeof(MeshFilter), typeof(MeshRenderer))]
public class MeshBuffer : MonoBehaviour
{
@cuongnmx
cuongnmx / ParticleSoundSystem
Created November 10, 2020 07:14 — forked from Laumania/ParticleSoundSystem
How To Play Sound Effect In Particle System In Unity
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using Hellmade.Sound;
//Script used in https://www.youtube.com/watch?v=jKSz8JJnL4E
[RequireComponent(typeof(ParticleSystem))]
public class FireworksParticleSoundSystem : MonoBehaviour
{
private ParticleSystem _parentParticleSystem;
@cuongnmx
cuongnmx / latency.txt
Created November 22, 2017 08:50 — forked from jboner/latency.txt
Latency Numbers Every Programmer Should Know
Latency Comparison Numbers
--------------------------
L1 cache reference 0.5 ns
Branch mispredict 5 ns
L2 cache reference 7 ns 14x L1 cache
Mutex lock/unlock 25 ns
Main memory reference 100 ns 20x L2 cache, 200x L1 cache
Compress 1K bytes with Zippy 3,000 ns 3 us
Send 1K bytes over 1 Gbps network 10,000 ns 10 us
Read 4K randomly from SSD* 150,000 ns 150 us ~1GB/sec SSD
@cuongnmx
cuongnmx / apache-yosemite-websharing.md
Created March 10, 2017 07:42 — forked from vr000m/apache-yosemite-websharing.md
Enabling WebSharing on OSX 10.10 (Yosemite)

the horror!

The jist of starting and stoping apache:

$ sudo apachectl start
$ sudo apachectl stop
$ sudo apachectl restart

if you care about the HTTPD version

@cuongnmx
cuongnmx / index.html
Created December 25, 2016 15:04 — forked from derofim/index.html
Cocos fullscreen web and mobile
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Cocos2d-html5 Hello World test</title>
<link rel="icon" type="image/GIF" href="res/favicon.ico"/>
<meta name="viewport" content="initial-scale=1">
<meta name="apple-mobile-web-app-capable" content="yes"/>
<meta name="full-screen" content="yes"/>
<meta name="screen-orientation" content="portrait"/>