Skip to content

Instantly share code, notes, and snippets.

View jerhon's full-sized avatar

Jeremy Honl jerhon

View GitHub Profile
@jerhon
jerhon / HexOps.cs
Last active January 2, 2023 23:10
Hex Operations in C#
public static class HexOps {
public static byte[] ToBytesFromHex(string hex) {
byte[] ret = new byte[hex.Length];
for (int i = 0; i < hex.Length; i++) {
ret[i] = Convert.ToByte(hex[i]);
}
return ret;
}
}
@jerhon
jerhon / setup_parcel_project.ps1
Created April 18, 2021 16:12
Setup Parcel Project
$project_dir="project_name"
mkdir $project_dir
cd $project_dir
npm init -y
# TODO: update npm license to MIT
# Add in commands to run parcel in develop / build
npm install typescript --save-dev
tsc --init
# TODO: command to update TSC to have jsx: React
@jerhon
jerhon / Program.cs
Last active October 16, 2019 17:55
.NET Core CommandLine Program (Simple Template)
using System.IO;
using System;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
namespace SampleApp {
class Program {
static void Main(string[] args) {
@jerhon
jerhon / foreign_key_table_references.sql
Last active August 29, 2019 15:13
Various SQL Server Queries that are helpful
-- Return referenced table name, and column for each foreign key constraint
DECLARE @TableID INT = OBJECT_ID('SCHEMA.TABLE')
select OBJECT_NAME(fkc.referenced_object_id) as referenced_table_name,
c.name as referenced_column,
fk.name as foreign_key_name,
OBJECT_NAME(fk.parent_object_id) as owning_table
from sys.foreign_keys fk
inner join sys.foreign_key_columns fkc on fk.object_id = fkc.constraint_object_id
inner join sys.columns c on fkc.referenced_column_id = c.column_id and fkc.parent_object_id = c.object_id
@jerhon
jerhon / DateTimeUtils.java
Created July 16, 2019 17:40
Java Basics
package com.honlsoft.utils;
public class DateTimeUtils {
public static LocalDate parseDate(String date) {
var datePattern = DateTimeFormatter.ofPattern("yyyyMMdd");
return LocalDate.parse(date, datePattern);
}
}
@jerhon
jerhon / angular_technical_interview.md
Last active April 30, 2020 14:35
Interview Questions

Angular Technical Interview Questions

  1. What is the last version of Angular you used for development?

  2. What is the purpose of a Component in Angular?

  3. What are the main pieces of a Component that need to be defined?

  4. What is the purpose of a Module in Angular?

@jerhon
jerhon / default.conf
Last active November 23, 2022 07:28
nginx HTTP configuration for SPA, with reverse proxy for API
# Typically I use this file as a boilerplate to configure an nginx docker container
#
# This goes in /etc/nginx/conf.d/default.conf
# If you are reverse proxying an API
upstream api {
server API_SERVER_GOES_HERE:port;
}
server {
@jerhon
jerhon / WebServiceClientImpl.java
Last active May 13, 2019 18:59
Java / Spring Framework / WebServiceGatewaySupport : Web service client with tracing, configurable read timeout
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import org.springframework.http.client.SimpleClientHttpRequestFactory;
import org.springframework.oxm.jaxb.Jaxb2Marshaller;
import org.springframework.ws.client.WebServiceClientException;
import org.springframework.ws.client.WebServiceIOException;
import org.springframework.ws.client.core.support.WebServiceGatewaySupport;
import org.springframework.ws.client.support.interceptor.ClientInterceptor;
import org.springframework.ws.context.MessageContext;