Skip to content

Instantly share code, notes, and snippets.

@hanzochang
hanzochang / xxx_decorator.rb
Created October 24, 2018 04:18
htmlデータをパースして、<a name>でのアンカリングと、目次一覧を生成する
# 本文に<a name>設置
#
# @return [String]
def anchored_content
doc = Nokogiri::HTML.parse(content)
doc = add_anchors(doc, 'h3')
doc = add_anchors(doc, 'h4')
doc.children.to_html
@hanzochang
hanzochang / threejs-glsl-sample.html
Created November 7, 2017 14:47
threejs-glsl-sample
<body>
<div id="container"></div>
<script src="https://cdnjs.cloudflare.com/ajax/libs/three.js/88/three.min.js"></script>
<script id="vertexShader" type="x-shader/x-vertex">
void main() {
gl_Position = vec4( position, 1.0 );
}
</script>
<script id="fragmentShader" type="x-shader/x-fragment">
precision mediump float;
@hanzochang
hanzochang / TArrayIntConvertTArrayFString.cpp
Created March 4, 2017 06:41
[UE4] Sample for converting TArray<int32> to TArray<FString> for show debbuging message.
FString FPlaneMesh::ToStringForDebug()
{
FString Result;
TArray<int32> TriangleA = { 1,2,3 };
TArray<int32> TriangleB = { 2,3,4 };
// lamda function for showing debugging message
auto TArrayConvertFString = [](TArray<int32> IntArray)
{
TArray<FString> StrArray;
@hanzochang
hanzochang / DebugMessageTemplate.cpp
Created March 4, 2017 05:22
[UE4] DebugMessageTemplate
if (GEngine) { GEngine->AddOnScreenDebugMessage(-1, 5.f, FColor::Red, TEXT("debugmessage")); }
@hanzochang
hanzochang / StructTemplate.cpp
Last active March 4, 2017 04:44
[UE4] Struct Template
// Fill out your copyright notice in the Description page of Project Settings.
#include "MyProject.h"
#include "MyStruct.h"
FMyStruct FMyStruct::New(int32 AwesomeInt, float AwesomeFloat)
{
FMyStruct MyStruct;
MyStruct.AwesomeInt = AwesomeInt;
MyStruct.AwesomeFloat = AwesomeFloat;
#include "ProceduralMeshComponent.h"
// Creating a standard root object.
AMyActor::AMyActor()
{
mesh = CreateDefaultSubobject<UProceduralMeshComponent>(TEXT("GeneratedMesh"));
RootComponent = mesh;
/**
* Create/replace a section for this procedural mesh component.
* @param SectionIndex Index of the section to create or replace.
@hanzochang
hanzochang / MyActor.cpp
Last active February 27, 2017 23:55
[UE4] Actor with StaticMesh Template
// Fill out your copyright notice in the Description page of Project Settings.
#include "MyProjecrt.h"
#include "MyActor.h"
// Sets default values
AMyActor::AMyActor()
{
// Set this actor to call Tick() every frame. You can turn this off to improve performance if you don't need it.
# Compiled Object files
*.slo
*.lo
*.o
*.obj
# Precompiled Headers
*.gch
*.pch
@hanzochang
hanzochang / AwesomeStruct.cpp
Last active March 4, 2024 23:36
[UE4(Unreal Engine 4)] Example for parsing json and creating struct instance from parsed json.
#include "ProcedualSpline.h"
#include "AwesomeStruct.h"
FAwesomeStruct FAwesomeStruct::BuildAwesomeStruct(
FVector AwesomeVector,
bool AwesomeBoolean,
float AwesomeFloat,
int32 AwesomeInteger,
FRotator AwesomeRotator
)