Skip to content

Instantly share code, notes, and snippets.

View binarybaba's full-sized avatar
✍️

Amin Mohamed Ajani binarybaba

✍️
View GitHub Profile
@binarybaba
binarybaba / git-mv-with-history
Created February 10, 2022 00:55 — forked from emiller/git-mv-with-history
git utility to move/rename file or folder and retain history with it.
#!/bin/bash
#
# git-mv-with-history -- move/rename file or folder, with history.
#
# Moving a file in git doesn't track history, so the purpose of this
# utility is best explained from the kernel wiki:
#
# Git has a rename command git mv, but that is just for convenience.
# The effect is indistinguishable from removing the file and adding another
# with different name and the same content.
@binarybaba
binarybaba / cookies.js
Created April 21, 2021 12:52 — forked from thinkclay/cookies.js
Cookie CRUD in JS
/**
* Custom Cookie Support for JS
*
* There aren't very many great ways of interacting with Cookies
* in either native JS or jQuery without the use of plugins
* so this snippet aims to give you quick and easy access
* to manipulate your cookies with native JS
*
* @author Clay McIlrath
* @link http://thinkclay.com/technology/add-edit-delete-cookies-with-javascript
diff --git a/src/App.js b/src/App.js
index b6ab68e..eef86a1 100644
--- a/src/App.js
+++ b/src/App.js
@@ -1,7 +1,14 @@
import React, { useState } from "react";
import { BehaviorSubject } from "rxjs";
import { getCityDetails } from "./xhr";
+import {
+ filter,
diff --git a/src/App.js b/src/App.js
index 274e962..b6ab68e 100644
--- a/src/App.js
+++ b/src/App.js
@@ -1,25 +1,21 @@
-import React, { useState, useEffect } from "react";
+import React, { useState } from "react";
import { BehaviorSubject } from "rxjs";
import { getCityDetails } from "./xhr";
import "./styles.css";
diff --git a/src/hooks.js b/src/hooks.js
index 1cbeb9f..568140f 100644
--- a/src/hooks.js
+++ b/src/hooks.js
@@ -1,17 +1,9 @@
-import { useEffect, useState } from "react";
-import { debounce } from "lodash";
-import { DEBOUNCE_MS } from "./constants";
+import { useEffect } from "react";
diff --git a/src/App.js b/src/App.js
index 720cea8..274e962 100644
--- a/src/App.js
+++ b/src/App.js
@@ -1,8 +1,11 @@
import React, { useState, useEffect } from "react";
+import { BehaviorSubject } from "rxjs";
import { getCityDetails } from "./xhr";
import "./styles.css";
import { useDebounce } from "./hooks";
import React, { useState, useEffect } from "react";
import { getCityDetails } from "./xhr";
import "./styles.css";
import { useDebounce } from "./hooks";
export default function App() {
const [searchText, setSearchText] = useState("");
const debouncedSearchText = useDebounce(searchText);
const [details, setDetails] = useState({});
export const getCityDetails = async (city) =>
fetch(
`https://api.teleport.org/api/cities/?search=${city}`
).then((response) => response.json());
import { useEffect, useState } from "react";
import { debounce } from "lodash";
import { DEBOUNCE_MS } from "./constants";
export const useDebounce = (searchTerm, delay = DEBOUNCE_MS) => {
const [debouncedValue, setDebouncedValue] = useState(searchTerm);
const debouncedHandler = debounce(() => {
setDebouncedValue(searchTerm);
}, delay);
diff --git a/voronoi-graph.js b/voronoi-graph.js
index ab86854..0dfd584 100644
--- a/voronoi-graph.js
+++ b/voronoi-graph.js
@@ -42,12 +42,18 @@ lines.selectAll("circle-group")
.style("fill", (d,i) => d.color)
.style('stroke-width', 2)
.style('opacity', 1)
- .on("mouseover", function(d) {
- div.transition().duration(200).style("opacity", .9);