Skip to content

Instantly share code, notes, and snippets.

View jdmiranda's full-sized avatar
💭
Building the future

Jeremy jdmiranda

💭
Building the future
View GitHub Profile
@jdmiranda
jdmiranda / enemy.cs
Created July 17, 2020 11:30
fat enemy script that i'm setting here for reference for myself
using UnityEngine;
using System.Collections;
using System.Collections.Generic;
[RequireComponent (typeof (UnityEngine.AI.NavMeshAgent))]
public class Enemy : LivingEntity {
#region AI
def count(A):
result = False
for i in A:
result += i
return result
def solution(A,X):
if (X > len(A)):
return -1
seen = [False] * X
@jdmiranda
jdmiranda / frogjmp.py
Created July 16, 2020 03:31
Frog Jump : A small frog wants to get to the other side of the road. The frog is currently located at position X and wants to get to a position greater than or equal to Y. The small frog always jumps a fixed distance, D. Count the minimal number of jumps that the small frog must perform to reach its target. Write a function: def solution(X, Y, D…
def solution(X,Y,D):
d = Y-X
a = d//D
if (d%D > 0):
a +=1
return a
x=10
def solution(A):
A.sort()
x = 0
l = len(A)
while x < l:
print(x)
if (x == l-1):
print('returning ',A[x])
@jdmiranda
jdmiranda / CyclicRotation.py
Created July 16, 2020 02:28
CyclicRotation
def solution(A,K):
l = len(A)
if (l == 0):
return A
if (K>l):
K = K % len(A)
x = A[:l-K]
@jdmiranda
jdmiranda / binary_gap.py
Created July 16, 2020 00:24
Binary Gap Solution using Binary Shift
def solution(N):
cnt = 0
result = 0
found_one = False
i = N
while i:
print 'i is : ', i
if i & 1 == 1:
@jdmiranda
jdmiranda / scroll_rect_snap.cs
Created November 23, 2019 23:09
scroll and endless rect ui like instagram
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
public class ScrollRectSnap : MonoBehaviour
{
public RectTransform panel;//Holds scrollPanel
public Button[] button;
public RectTransform center; //Center to compare the distance for each button
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
public class PhoneCamera : MonoBehaviour
{
private bool camAvailable;
private WebCamTexture backCam;
private Texture defaultBackground;
from os import listdir # to display available input files
import heapq # for priority queue
import math
from time import time # for run times
import matplotlib.pyplot as plt # to display solutions
import numpy as np #for polygon
%matplotlib inline
print('Available input files:')
dataDir = 'data2' # directory with input files
@jdmiranda
jdmiranda / fizzbuzz.exs
Last active July 6, 2016 16:43
Elixir FizzBuzz
# defmodule FizzBuzz do
# def upto(n) when n > 0 do
# 1..n |> Enum.map(&fizzbuzz/1)
# end
#
# defp fizzbuzz(n) when rem(n, 3) == 0 and rem(n, 5) == 0, do: "FizzBuzz"
# defp fizzbuzz(n) when rem(n, 3) == 0, do: "Fizz"
# defp fizzbuzz(n) when rem(n, 5) == 0, do: "Buzz"
# defp fizzbuzz(n), do: n
# end