Skip to content

Instantly share code, notes, and snippets.

View cyrilzakka's full-sized avatar
💭
coding...

Cyril Zakka, MD cyrilzakka

💭
coding...
View GitHub Profile
@cyrilzakka
cyrilzakka / ContentView.swift
Created September 25, 2023 20:05 — forked from alexwidua/ContentView.swift
SwiftUI Grid Animation
import SwiftUI
// 1. Use looped H/VStacks to create a grid
// 2. Conditionally increase spacing to grow/shrink the grid
// 3. Calculate the distance of each dot to the center and use the value to stagger the animation
//4. Add random delay on top of the staggered delay value
struct ContentView: View {
// const & state
@cyrilzakka
cyrilzakka / ContentView.swift
Created July 26, 2019 21:03
Simple Image Viewer using SwiftUI
//
// ContentView.swift
// Scribe
//
// Created by Cyril Zakka on 7/21/19.
// Copyright © 2019 Cyril Zakka. All rights reserved.
//
import SwiftUI
struct ContentView: View {
struct Card : Identifiable {
var id = UUID()
var imageName: String
}
struct CardView: View {
var card: Card
var body: some View {
@cyrilzakka
cyrilzakka / FrozenEnv_GeneticAlgo.py
Created May 6, 2018 02:31
Frozen Lake Environment (OpenAI Gym) Solution using a Genetic Algorithm
import numpy as np
import random
import time
import gym
from gym import wrappers
random.seed(1234)
np.random.seed(1234)
def generate_random_policy():
@cyrilzakka
cyrilzakka / FrozenEnv_RandomPolicy.py
Last active May 3, 2018 19:18
Frozen Lake Environment (OpenAI Gym) Solution using Random Policy
import numpy as np
import gym
import time
def generate_random_policy():
# Generates a vector of shape (16,) with an action between 0 and 3 (inclusive)
return np.random.choice(4, size=((16)))
def run_episode(env, policy, n_episodes=100, render=False):
total_reward = 0