Skip to content

Instantly share code, notes, and snippets.

View ashrafmajdee's full-sized avatar
🏠
Working from home

Ashraf ashrafmajdee

🏠
Working from home
View GitHub Profile
@ashrafmajdee
ashrafmajdee / FootIK
Created May 7, 2020 13:48 — forked from Orixe/FootIK
Free Foot IK system for unity
using UnityEngine;
[RequireComponent(typeof(Animator))]
public class FootIK : MonoBehaviour
{
[Header("Main")]
[Range(0, 1)] public float Weight = 1f;
[Header("Settings")]
public float MaxStep = 0.5f;
public float FootRadius = 0.15f;
@ashrafmajdee
ashrafmajdee / OpposingKeyPressInteraction.cs
Last active August 14, 2023 05:03
Unity input system interaction to detect if opposing keys like left/right is pressed simultaneously and delay the interaction to see if one of the key's is released. One use cases is, if using a state machine with Input magnitude for character movement, character can keep moving from one direction to the opposite without going to 'Idle' state.
using UnityEngine;
using UnityEngine.InputSystem;
#if UNITY_EDITOR
[UnityEditor.InitializeOnLoad]
#endif
public class OpposingKeyPressInteraction : IInputInteraction
{
public float HoldDuration = 0.15f;
@ashrafmajdee
ashrafmajdee / 016_session_store.rb
Created February 9, 2024 01:50 — forked from jstorimer/016_session_store.rb
Multiple session store implementation
RedisSessionStore.logger = Rails.logger
session_options = {:expire_after => 1.day, :key_prefix => 'sessions'}
MultiSessionStore.stores[:plain] = [RedisSessionStore, session_options.merge(:key => '_session_id')]
MultiSessionStore.stores[:secure] = [RedisSessionStore, session_options.merge(:key => '_secure_session_id', :secure => ['production', 'staging'].include?(Rails.env))]
MultiSessionStore.default_store = :plain
MultiSessionStore.routes = [
['/admin', :secure],
]