Skip to content

Instantly share code, notes, and snippets.

View harismh's full-sized avatar

Haris Muhammad harismh

View GitHub Profile
// @flow
import React from "react";
import * as WebBrowser from "expo-web-browser";
import Constants from "expo-constants";
import {
makeRedirectUri,
useAuthRequest,
useAutoDiscovery
} from "expo-auth-session";
import {
@harismh
harismh / advent-of-code-day-1-part-2.js
Last active January 7, 2022 19:57
Advent of Code Day 1 Solution
// helpers
const sum = (...nums) => nums.reduce((sum, num) => (sum += num) && sum, 0);
const createWindow = size => new Array(size).fill(null);
const insertAndCopy = (val, idx, arr) =>
arr
.slice(0, idx)
.concat([val])
.concat(arr.slice(idx + 1));
// provided data
@harismh
harismh / tic_tac_toe_magic_squares.clj
Created October 11, 2024 16:56
Tic-Tac-Toe Magic Squares
(ns tic-tac-toe-magic-squares
(:require [clojure.math.combinatorics :refer [combinations]]))
(defn magic-square-n [magic-square]
(int (Math/sqrt (count magic-square))))
(defn range-n2 [n]
(range 1 (+ 1 (* n n))))
(defn magic-constant [n]