Skip to content

Instantly share code, notes, and snippets.

View danielrobertson's full-sized avatar
☁️
Working on Cloudflare dashboard experiences

Daniel danielrobertson

☁️
Working on Cloudflare dashboard experiences
View GitHub Profile
@danielrobertson
danielrobertson / vocab_1a.txt
Created October 30, 2022 07:43
Dongguk 1A vocab
가다,to go, 1A
비싸다,to be expensive, 1A
켜요,to turn on, 1A
꺼요,to turn off, 1A
바빠요,to be busy, 1A
느려요, slow, 1A
짜요, salty , 1A
공원, park, 1A
공항, airport, 1A
만나요,to meet  , 1A
name: Build and Deploy Storybook
on:
push:
paths: ["frontend-components/**", ".storybook/**"] # Trigger the action only when files change in the folders defined here
jobs:
build-and-deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2.3.1
@danielrobertson
danielrobertson / index.html
Last active December 16, 2019 20:10
Filter photos by tags on click
<!DOCTYPE html>
<html>
<script>
const showTiles = function(tag) {
// reset any previously hidden tiles
if (tag !== "all") {
showTiles("all");
}
// get all HTML elements with css class tile
@danielrobertson
danielrobertson / conway.js
Created February 12, 2019 19:09
Conway's game of life
/*
Input:
an n by m grid of "alive" or "dead" cells
Output:
a transformation on the input grid using the following rules:
- An "alive" cell remains alive if 2 or 3 neighbors are "alive." Otherwise, it becomes "dead."
- A "dead" cell becomes alive if exactly 3 neighbors are "alive." Otherwise, it remains "dead."
(The term "neighbor" refers to the at-most-8 adjacent cells horizontally, vertically, and diagonally.)
@danielrobertson
danielrobertson / firestoreUpload.js
Last active June 13, 2018 15:48
How to upload a list of JSON documents to Google Firestore. This script puts documents into a collection named "animals"
const firebase = require("firebase-admin");
const serviceAccount = require("./firebase-config.json"); // from the Firebase project overview page
firebase.initializeApp({
credential: firebase.credential.cert(serviceAccount),
databaseURL: "https://<PROJECT_NAME>.firebaseio.com"
});
// this code could theoretically run in a Cloud Function as the back-end to a volunteer filling out a form,
// or scraping a 3rd party animal database, which will spin through the records and create entries in Firestore
void radixSort(int arr[], int maxDigits) {
int exp = 1;
for (int i = 0; i < maxDigits; i++) {
ArrayList bucketList[] = new ArrayList[10];
for (int k = 0; k < 10; k++) {
bucketList[k] = new ArrayList();
}
void quickSort(int arr[], int left, int right) { //Confirmed
int index = partition(arr, left, right);
if (left < index - 1) { //when sorting 2 3 1, will return 2 1 3, left point at 3 and 2 1 unsorted
quickSort(arr, left, index - 1);
}
if (index < right) { //when sorting 3 1 2, will return 1 3 2, index at 3 and right is 2.
quickSort(arr, index, right);
}
}
void mergesort(int[] array) {
int[] helper = new int[array.length];
mergesort(array, helper, 0, array.length - 1);
}
void mergesort(int[] array, int[] helper, int low, int high) {
if (low < high) {
int middle = (low + high) / 2;
mergesort(array, helper, low, middle); // left
mergesort(array, helper, middle + 1, high); // right
int binarySearch(int[] a, int x) {
int low = 0;
int high = a.length - 1;
int mid;
while (low <= high) {
mid = (low + high)
if (a[mid] < x) {
low = mid + 1;
} else if(a[mid]>x){
boolean isPrime(int n) {
if(n < 2) return false;
for(int i = 2; i <= Math.sqrt(n); ++i) {
if(n % i == 0) return false;
}
return true;
}