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
using System;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using NUnit.Framework;
using WatiN.Core;
using System.Collections.Generic;
using System.Linq;
namespace Watin_Tests
@jdmiranda
jdmiranda / ObjectReplacer.cs
Last active April 9, 2016 21:43
Unity3D Editor Script to replace objects in a scene.
using UnityEngine;
using System.Collections;
using UnityEditor;
using System.Text;
public class ObjectReplacer : ScriptableWizard
{
private Transform[] transforms = Selection.GetTransforms(SelectionMode.TopLevel | SelectionMode.ExcludePrefab);
private static string strShowDialogsKey = "ObjectReplacer.ShowDialogs";
@jdmiranda
jdmiranda / Math.cpp
Last active April 18, 2016 21:55
math library for 3d math
bool Math::IsOrthonormal(Vector p, Vector q) {
int i = 0;
if (p == q)
i = 1;
return (DotProduct(p,q) == i);
}
bool Math::IsOrthonormal(std::vector<Vector> v)
{
# /etc/bash.bashrc
#
# https://wiki.archlinux.org/index.php/Color_Bash_Prompt
#
# This file is sourced by all *interactive* bash shells on startup,
# including some apparently interactive shells such as scp and rcp
# that can't tolerate any output. So make sure this doesn't display
# anything or bad things will happen !
# Test for an interactive shell. There is no need to set anything
@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
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
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;
@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
@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 / 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]