Skip to content

Instantly share code, notes, and snippets.

View aanufriyev's full-sized avatar

Aleksei Anufriev aanufriyev

View GitHub Profile
@zr0n
zr0n / Projectile.cpp
Last active June 19, 2024 20:41
Custom projectile movement, wall penetration and damage using Unreal Engine 4
// Fill out your copyright notice in the Description page of Project Settings.
#include "Projectile.h"
#include "Kismet/KismetMathLibrary.h"
#include "Kismet/KismetSystemLibrary.h"
#include "Kismet/KismetStringLibrary.h"
#include "Kismet/KismetMathLibrary.h"
#include "Kismet/GameplayStatics.h"
@ramachandrajr
ramachandrajr / GamePlayStatistics.cpp:
Last active June 28, 2024 23:38
SuggestProjectileVelocity function from unreal engine
/** SuggestProjectileVelocity **/
// note: this will automatically fall back to line test if radius is small enough// Based on analytic solution to ballistic angle of launch http://en.wikipedia.org/wiki/Trajectory_of_a_projectile#Angle_required_to_hit_coordinate_.28x.2Cy.29bool UGameplayStatics::SuggestProjectileVelocity(const UObject* WorldContextObject, FVector& OutTossVelocity, FVector Start, FVector End, float TossSpeed, bool bFavorHighArc, float CollisionRadius, float OverrideGravityZ, ESuggestProjVelocityTraceOption::Type TraceOption, const FCollisionResponseParams& ResponseParam, const TArray<AActor*>& ActorsToIgnore, bool bDrawDebug){
const FVector FlightDelta = End - Start;
const FVector DirXY = FlightDelta.GetSafeNormal2D();
const float DeltaXY = FlightDelta.Size2D();
const float DeltaZ = FlightDelta.Z;
const float TossSpeedSq = FMath::Square(TossSpeed);
@NickCraver
NickCraver / Http.cs
Last active January 17, 2020 01:10
HttpClient Ideas
using System;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Collections.Immutable;
using System.ComponentModel;
using System.Diagnostics;
using System.IO;
using System.IO.Compression;
using System.Linq;
using System.Net;
@xcud
xcud / lessons-learned.md
Last active August 17, 2017 03:02
Lessons Learned by Eric Schmidt transcribed by Abheek Anand

Lessons Learned – The Hard Way Eric Schmidt, E&VC Final Class Transcribed by Abheek Anand

About Management Culture:

  • You get personal leverage through delegation and empowerment, along with inspection
  • Hiring defines a company. Review every job offer every time.
  • Manager (or teams reporting to a manager) should never have the unilateral authority to hire people.
  • Major decisions should be made in large groups, by two joint owners.
  • Be careful about goal-misalignment; goaling drives behavior and conflict.
@alexandrnikitin
alexandrnikitin / AhoCorasickTree.cs
Created May 1, 2017 18:46
Aho-Corasick with some perf improvements
using System;
using System.Collections.Generic;
namespace Adform.AdServing.AhoCorasickTree.Sandbox.V7g
{
public class AhoCorasickTree
{
internal AhoCorasickTreeNode Root { get; set; }
public AhoCorasickTree(IEnumerable<string> keywords)
@alexandrnikitin
alexandrnikitin / AhoCorasickTree.cs
Created April 14, 2017 07:44
Aho-Corasick C# implementation
using System.Collections.Generic;
using System.Linq;
namespace AhoCorasickTree
{
public class AhoCorasickTree
{
internal AhoCorasickTreeNode Root { get; set; }
public AhoCorasickTree(IEnumerable<string> keywords)
@NickCraver
NickCraver / GitHubTrendingWeekly.ps1
Last active January 4, 2021 09:59
A weekly task that pops up https://github.com/trending in Chrome to find interesting OSS projects.
Register-ScheduledTask `
-Action (New-ScheduledTaskAction `
-Execute ((Get-ItemProperty "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\chrome.exe")."(default)") `
-Argument 'https://github.com/trending') `
-Trigger (New-ScheduledTaskTrigger -Weekly -DaysOfWeek Monday -At 3am) `
-TaskName "GitHub Trending" `
-Description "Weekly check of GitHub trending repos."
@NickCraver
NickCraver / Examples.cs
Last active April 16, 2019 01:56
SQL Exception handy helpers
// Here are some example usages for unimportant jobs we have where crap happens occasionally:
/// <summary>
/// intended for database commands that might deadlock, but are just "nice to haves"; we don't care if they deadlock every now and then
/// and we DON'T want them to block execution of the rest of /daily or /hourly! this returns -1 if deadlocked, otherwise, returns
/// the # of rows that the SQL command affected
/// </summary>
private int ExecuteIgnoreDeadlocks(string sql, object param = null, bool logDeadlock = false)
{
try
@NickCraver
NickCraver / Build.xml
Last active June 28, 2024 07:54
Stack Overflow Build Reference Docs
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="PrepareStaticContent" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<!-- Passed in Parameters -->
<configuration></configuration>
<workingDir></workingDir>
<buildNumber></buildNumber>
<buildViews>false</buildViews>
<minifyJs>true</minifyJs>
<TargetsDirectory></TargetsDirectory>
@davidfowl
davidfowl / Example1.cs
Last active June 19, 2024 16:41
How .NET Standard relates to .NET Platforms
namespace Analogy
{
/// <summary>
/// This example shows that a library that needs access to target .NET Standard 1.3
/// can only access APIs available in that .NET Standard. Even though similar the APIs exist on .NET
/// Framework 4.5, it implements a version of .NET Standard that isn't compatible with the library.
/// </summary>INetCoreApp10
class Example1
{
public void Net45Application(INetFramework45 platform)