Skip to content

Instantly share code, notes, and snippets.

Avatar
🏆
Focusing

Yari @bitwaker ariok

🏆
Focusing
View GitHub Profile
View EnvQueryGenerator_GridOffset.cpp
// Fill out your copyright notice in the Description page of Project Settings.
#include "EnvQueryGenerator_GridOffset.h"
#include "AI/Navigation/NavigationTypes.h"
#include "EnvironmentQuery/Contexts/EnvQueryContext_Querier.h"
#define LOCTEXT_NAMESPACE "EnvQueryGenerator"
UEnvQueryGenerator_GridOffset::UEnvQueryGenerator_GridOffset()
{
@ariok
ariok / MyAIController.cpp
Created May 20, 2019
How to run EQS in C++
View MyAIController.cpp
#include "MyAIController.h"
#include "EnvironmentQuery/EnvQueryManager.h"
void AMyAIController::FindHidingSpot()
{
FEnvQueryRequest HidingSpotQueryRequest = FEnvQueryRequest(FindHidingSpotEQS, this);
HidingSpotQueryRequest.Execute(EEnvQueryRunMode::SingleResult, this, &AMyAIController::MoveToQueryResult);
}
@ariok
ariok / AAIControllerTeam.cpp
Last active Aug 4, 2020
UE4 Perception AI System: Detect By Affiliation
View AAIControllerTeam.cpp
#include "AIControllerTeam.h"
// A Tutorial for this code is available here:
// https://www.thinkandbuild.it/ue4-ai-perception-system/
AAIControllerTeam::AAIControllerTeam()
{
SetGenericTeamId(FGenericTeamId(5));
}
View Xcode7TestIssue.swift
//This code works correctly in the Application target, while in the Test target I get this warning:
//Cast from 'XCUIElement!' to unrelated type 'String' always fails.
//JSON is of type AnyObject?
let fieldErrors = JSON!["errors"] as? [String:String]
//I've already tried to convert this code in a more "swift 2" format using guard and removing the "optional"...nothing changes.
@ariok
ariok / [swift]NSBundle-version-build.swift
Created Jul 7, 2015
[swift] Extend NSBundle to get Version and Build info
View [swift]NSBundle-version-build.swift
extension NSBundle {
class var versionNumber: String {
if let version = NSBundle.mainBundle().infoDictionary?["CFBundleShortVersionString"] as? String {
return version
}
return "N.D."
}
class var buildNumber: String {
@ariok
ariok / [swift]ArrayExtension.swift
Created Jun 27, 2014
[swift]Adding support for "indexOf:" and "contains:" to Array
View [swift]ArrayExtension.swift
extension Array {
func contains(object:AnyObject) -> Bool {
return self.bridgeToObjectiveC().containsObject(object)
}
func indexOf(object:AnyObject) -> Int {
return self.bridgeToObjectiveC().indexOfObject(object)
}
}
@ariok
ariok / [swift]Singleton.swift
Last active Aug 29, 2015
[swift]Thread-Safe Singleton implementation
View [swift]Singleton.swift
class Manager {
class var sharedManager : Manager {
struct Singleton {
static let instance : Manager = Manager() // let is Thread-safe
}
return Singleton.instance
}
}
@ariok
ariok / [swift]extension_readability.swift
Last active Aug 29, 2015
[swift]Extensions to help code readability
View [swift]extension_readability.swift
import UIKit
class ViewController: UIViewController {
@IBOutlet var searchBar:UISearchBar
@IBOutlet var tableView:UITableView
override func viewDidLoad() {
super.viewDidLoad()
}
@ariok
ariok / [Playground]Quicksort_caching_generics.swift
Created Jun 18, 2014
Quicksort in Swift using Generics (Not in-place)
View [Playground]Quicksort_caching_generics.swift
import Cocoa
func quicksort<T: Comparable>(array:T[])->T[] {
var less = T[](), equal = T[](), greater = T[]()
if array.count > 1{
let pivot = array[0]
for x in array{
@ariok
ariok / [Playground]Quicksort_caching.swift
Last active Aug 29, 2015
Quicksort in Swift (Not in-place)
View [Playground]Quicksort_caching.swift
import Cocoa
func quicksort(array:Int[])->Int[] {
var less = Int[](), equal = Int[](), greater = Int[]()
if array.count > 1{
let pivot = array[0]
for x in array{
You can’t perform that action at this time.