Skip to content

Instantly share code, notes, and snippets.

View connor-davis's full-sized avatar
💡
Learning

Connor Davis connor-davis

💡
Learning
View GitHub Profile
@connor-davis
connor-davis / json_to_sql.rs
Last active August 14, 2024 09:36
Takes a specifically defined json object and converts it to a sql query.
use anyhow::Error;
use serde_json::{json, Value};
use crate::utils::merge_json;
pub async fn report_to_sql(report: Value) -> Result<String, Error> {
let table = report["table"].as_object();
if table.is_none() {
return Err(Error::msg("Table not found."));
@connor-davis
connor-davis / App.jsx
Last active December 26, 2022 10:33
This gist displays how I am working with the strapi cms to dynamically render pages on the frontend.
import { Link, Route, Routes } from "@solidjs/router";
import HeaderImage from "./assets/header.jpg";
import LogoImage from "./assets/logo.jpg";
import axios from "axios";
import { createStore } from "solid-js/store";
import { onMount } from "solid-js";
const PageTextToHtml = ({ content }) => {
const parser = new DOMParser(); // Create a new DOMParser instance.
@connor-davis
connor-davis / Movie.java
Created August 2, 2022 03:40
For DebugNine2 For DebugNine2
public class Movie {
private String name;
private int year;
public Movie(String name, int year) {
this.name = name;
this.year = year;
}
public String getName() {
import java.util.Scanner;
public class DebugNine2 {
public static void main(String[] args) {
Scanner input = new Scanner(System.in);
Movie[] movies = new Movie[8];
// Removed unnecessary code.
String message, entry;
/*
@connor-davis
connor-davis / InsertionSortAlgorithm.java
Created July 25, 2022 12:31
Java Insertion Sort Algorithm
/**
* This method will use the insertion sort algorithm to sort an int[] of
* numbers.
*
* @param numbers
*
* @return int[]
*/
public static int[] insertionSort(int[] numbers) {
int n = numbers.length;
@connor-davis
connor-davis / BubbleSortAlgorithm.java
Created July 25, 2022 12:30
Java Bubble Sort Algorithm
/**
* This method will use the bubble sort algorithm to sort an int[] of numbers.
*
* @param numbers
*
* @return int[]
*/
public static int[] bubbleSort(int[] numbers) {
for (int x = 0; x < numbers.length; x++) {
for (int i = 0; i < numbers.length - 1; i++) {
/*
* Connor Davis
* @author ST10068305
*/
package intro;
public class App {
public static String getGreeting() {
return "Hello World!";
}
@connor-davis
connor-davis / FahrenheitToCelsiusConverter.java
Created March 15, 2022 06:56
This program will convert fahrenheit to celsius
/*
* Connor Davis
* @author ST10068305
*/
package fahrenheittocelsius;
import javax.swing.JOptionPane;
public class App {
/**
/*
* Connor Davis
* @author ST10068305
*/
package room;
public class Room {
/**
* @param args The Command Line Arguments
*/
@connor-davis
connor-davis / InputOne.java
Created March 7, 2022 12:21
InputOne Code
/*
* This Java source file was generated by the Gradle 'init' task.
*/
package inputone;
import java.io.IOException;
import java.util.Scanner;
public class InputOne {
public static void main(String[] args) {