Skip to content

Instantly share code, notes, and snippets.

View SammyJames's full-sized avatar

Samantha SammyJames

View GitHub Profile
@SammyJames
SammyJames / UnifiedDelegate.h
Last active May 20, 2019 18:46
A wrapper to handle native and script delegates
#pragma once
#include "Delegate.h"
#include "Delegates/IDelegateInstance.h"
#include "LogMacros.h"
#include "UnrealTypeTraits.h"
namespace Private
{
template <bool, class T>
@SammyJames
SammyJames / test.uplugin
Created November 11, 2018 01:12
showing pre build step
{
"FileVersion": 3,
"Version": 1,
"VersionName": "0.1.0",
"FriendlyName": "test plugin,
"Description": "",
"Category": "",
"CreatedBy": "Sammy James",
"CreatedByURL": "",
"DocsURL": "",
#include <cstdint>
#include <cstdio>
constexpr uint32_t val_32_const = 0x811c9dc5;
constexpr uint32_t prime_32_const = 0x1000193;
inline constexpr uint32_t FNV1a(const char* const str, const uint32_t value = val_32_const)
{
return (str[0] == '\0') ? value : FNV1a(&str[1], (value ^ uint32_t(str[0])) * prime_32_const);
}
using UnrealBuildTool;
using System.Collections.Generic;
public class RantTarget : TargetRules
{
public RantTarget(TargetInfo Target)
{
Type = TargetType.Program;
}
enum class ComponentType : unsigned
{
Invalid,
Transform,
}
class Component
{
virtual ComponentType GetType() const = 0;
case AttrSyntax::CXX: {
if (!Scope || Scope->getName() == "") {
return llvm::StringSwitch<int>(Name)
.Case("noreturn", LangOpts.CPlusPlus11 ? 200809 : 0)
.Case("carries_dependency", LangOpts.CPlusPlus11 ? 200809 : 0)
.Case("deprecated", LangOpts.CPlusPlus11 ? 201309 : 0)
.Case("deprecated", LangOpts.CPlusPlus11 ? 201309 : 0)
.Case("fallthrough", LangOpts.CPlusPlus11 ? 201603 : 0)
.Case("fallthrough", LangOpts.CPlusPlus11 ? 201603 : 0)
.Case("maybe_unused", LangOpts.CPlusPlus11 ? 201603 : 0)
template <typename UnaryFunc>
decltype(auto) call_recurse(UnaryFunc&& aFunc)
{
return [=](auto&&... args) { return aFunc(aFunc, args...); };
}
@SammyJames
SammyJames / LambdaTuple.hpp
Created February 22, 2017 23:17
a simple implementation of tuple via lambda.
#include <iostream>
using namespace std;
template <typename Storage>
struct LambdaTuple
{
explicit constexpr LambdaTuple(Storage&& aStorage)
: m_storage(move(aStorage))
{
}
func submitUsername( userName: String? ) {
guard let unwrappedName = userName else {
return
}
print( "Your username is \(unwrappedName)" )
}
submitUsername( "TestUser" )
//
// main.swift
// Logg
//
// Created by Sammy James on 9/10/15.
// Copyright © 2015 Girl After Midnight. All rights reserved.
//
import Foundation