Skip to content

Instantly share code, notes, and snippets.

View CarlLee's full-sized avatar

Carl Lee CarlLee

  • Chongqing China
View GitHub Profile
@CarlLee
CarlLee / DebugCPP.cs
Last active September 23, 2019 08:01
Unity C++ Debug
using AOT;
using System;
using System.Runtime.InteropServices;
using UnityEngine;
public class DebugCPP : MonoBehaviour
{
// Use this for initialization
void OnEnable()
@CarlLee
CarlLee / see_through.shader
Created September 18, 2019 08:55
Unity See through shader
Shader "Unlit/SeeThrough"
{
Properties
{
_Color ("Color", Color) = (1.0, 1.0, 1.0, 1.0)
}
SubShader
{
Tags { "RenderType"="Transparent" "Queue" = "Transparent" }
LOD 100
@CarlLee
CarlLee / Bloom.shader
Last active August 27, 2024 02:43
UE4 bloom for unity
Shader "Hidden/Bloom"
{
Properties
{
_MainTex ("Texture", 2D) = "white" {}
}
HLSLINCLUDE
#include "Packages/com.unity.render-pipelines.lightweight/ShaderLibrary/Core.hlsl"
struct appdata
@CarlLee
CarlLee / ecs.lua
Created June 17, 2019 09:47
Simple ecs implementation
local Entity = {
}
local EntityMeta = {
__index = function(entity, key)
local o = rawget(Entity, key)
if(o ~= nil) then
return o
end
local component_id = key
if(type(component_id) == "string") then
@CarlLee
CarlLee / array_flatten.js
Created October 16, 2018 08:16
An answer to a programming test from CitrusByte in Javascript.
/*
* Flattens a nested array into a one-dimentional array of the exact same order
*
* @param {Array} arr
* @return {Array} result
*/
function flattenArray(arr) {
// Internal function to flatten the input array recursively
function flattenArrayRecursively(arr, result) {
for(let i = 0; i < arr.length; i++) {
html_doc = """
<html><head><title>The Dormouse's story</title></head>
<body>
<p class="title"><b>The Dormouse's story</b></p>
<p class="story">Once upon a time there were three little sisters; and their names were
<a href="http://example.com/elsie" class="sister" id="link1">Elsie</a>,
<a href="http://example.com/lacie" class="sister" id="link2">Lacie</a> and
<a href="http://example.com/tillie" class="sister" id="link3">Tillie</a>;
and they lived at the bottom of a well.</p>
var Sequelize = require('sequelize');
var DataTypes = Sequelize.DataTypes;
var sequelize = new Sequelize(
// ignore configs
);
// Represents user account information
var User = sequelize.define("user", {
username : { type : DataTypes.STRING },
password : { type : DataTypes.STRING },
const originalData = [
{ name: 'jch', age: 30, score: 90, sex: 1, lesson: 'math' },
{ name: 'oh', age: 31, score: 80, sex: 1, lesson: 'math' },
{ name: 'jia', age: 27, score: 70, sex: 0, lesson: 'math' },
{ name: 'jch', age: 30, score: 80, sex: 1, lesson: 'english' }
];
function findAgeGreaterThan(age) {
return originalData.filter((obj) => obj['age'] > age);
}
function sumTwoLargerNum(a, b, c){
var min = a <= b ? a : b;
min = min <= c ? min : c;
return a + b + c - min;
}
package net.linni.webservice.controller.advice;
import net.linni.webservice.exception.AbstractRestAPIException;
import net.linni.webservice.exception.OperationFailureException;
import net.linni.webservice.exception.UnauthorizedOperationException;
import net.linni.webservice.model.Response;
import net.linni.webservice.util.ResponseCode;
import net.linni.webservice.util.ResponseFactory;
import org.springframework.beans.TypeMismatchException;