Skip to content

Instantly share code, notes, and snippets.

View embiem's full-sized avatar

Martin Beierling-Mutz embiem

View GitHub Profile
@embiem
embiem / UE4 Get Look Direction
Created June 24, 2016 07:24
A function to get the look rotation by supplying it with a screen location (e.g. half the viewportSize, to use the middle of the screen). Useful for crosshairs
bool GetLookDirection(FVector2D ScreenLocation, FVector& LookDirection) const
{
FVector CameraWorldLocation;
return DeprojectScreenPositionToWorld(
ScreenLocation.X,
ScreenLocation.Y,
CameraWorldLocation,
LookDirection
);
}
@embiem
embiem / cartpole_qlearner.py
Created February 9, 2017 11:14
OpenAI Gym Q-Learner for the cartpole environment
'''
Very basic Q-Learner that is tailored for the cart-pole environment.
This implementation leaves a lot of space for improvements.
'''
import gym
from gym import wrappers
import math
@embiem
embiem / TagInput.css
Created April 20, 2017 13:50
TagInput-Component for React
.tags-input {
display: flex;
flex-direction: row;
flex-wrap: wrap;
align-content: flex-start;
justify-content: center;
}
.tags-input .tag-entry {
user-select: none;
cursor: pointer;
@embiem
embiem / AdobeButton.js
Created June 23, 2017 08:06
Adobe App-styled button as a React Component
import React, { Component } from 'react';
import './AdobeButton.css';
/**
* Adobe-Style button
*/
class AdobeButton extends Component {
render() {
const { text, onClick } = this.props;
@embiem
embiem / DynamicScale.cs
Created July 5, 2017 11:39
Stretch object based on its speed and movement direction (original by @_pikopik https://twitter.com/_pikopik/status/882346033656844288) #Unity
using UnityEngine;
[ExecuteInEditMode]
public class DynamicScale : MonoBehaviour
{
Vector3 lastPosition;
void Start()
{
lastPosition = transform.position;
@embiem
embiem / screenshot.js
Last active September 19, 2017 08:58
Create a full-height screenshot of a website using [puppeteer](https://github.com/GoogleChrome/puppeteer)
const puppeteer = require('puppeteer');
const width = 1200;
const url = process.argv.length > 2 ? process.argv[2] : 'https://ea.com';
const screenshotPath = process.argv.length > 3 ? process.argv[3] : 'screenshot.png';
console.log(`${url} --> ${screenshotPath}`);
(async () => {
const browser = await puppeteer.launch();
try {
bool GetSightRayHitLocation(FVector& HitLocation) const
{
// Find crosshair position in pixel coordinates
int32 ViewportSizeX, ViewportSizeY;
GetViewportSize(ViewportSizeX, ViewportSizeY);
FVector2D ScreenLocation = FVector2D(ViewportSizeX * CrossHairXLocation, ViewportSizeY * CrossHairYLocation);
// "De-project" the screen position of the crosshair to a world direction
FVector LookDirection, LookStartLocation;
@embiem
embiem / .vscodestyles.css
Last active January 19, 2018 14:43
vscode custom css
.monaco-shell {
font-family: "Operator Mono", "Inconsolata", monospace;
}
/*
Fat Cursor.
This overwrites the "underline thin" style since that is one that can be styled with CSS
So set your settings to:
"editor.cursorStyle": "underline-thin",
*/

Keybase proof

I hereby claim:

  • I am embiem on github.
  • I am mbeierling (https://keybase.io/mbeierling) on keybase.
  • I have a public key ASDa9PSKmSTOIZzmhEuvoxEDmsFWWOSGXC3PkpQcPls6pQo

To claim this, I am signing this object:

@embiem
embiem / ml-intro-ml-in-gamedev-workshop.ipynb
Last active October 22, 2019 14:58
ML Intro & ML in GameDev Workshop.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.