Skip to content

Instantly share code, notes, and snippets.

View richardwei6's full-sized avatar
🤔

Richard Wei richardwei6

🤔
View GitHub Profile
@richardwei6
richardwei6 / workshop2.swift
Created November 6, 2021 19:24
Coding Club Workshop 2
//
// Page2.swift
// iOSWorkshop
//
// Created by Richard Wei on 11/6/21.
//
import Foundation
import UIKit
@richardwei6
richardwei6 / workshop.swift
Created November 6, 2021 19:24
Coding Club Workshop Code 1
//
// ViewController.swift
// iOSWorkshop
//
// Created by Richard Wei on 11/6/21.
//
import UIKit
class ViewController: UIViewController {
@richardwei6
richardwei6 / workshop.c
Created October 17, 2021 03:38
Coding Club C Workshop 3
#include <stdio.h>
#include <math.h>
int main(){
char a;
printf( "Enter a value: ");
a = getchar( );
@richardwei6
richardwei6 / workshop.c
Created October 17, 2021 03:20
Coding Club C Workshop 2
#include <stdio.h>
#include <math.h>
int main(){
printf("\n%f", ceil(3.6));
printf("\n%f", ceil(3.3));
printf("\n%f", floor(3.6));
printf("\n%f", floor(3.2));
printf("\n%f", sqrt(16));
@richardwei6
richardwei6 / workshop.c
Last active October 17, 2021 03:21
Coding Club C Workshop 1
#include <stdio.h>
#include <stdbool.h>
#include <math.h>
int main(){
printf("Hello World\nNew line\nTest");
@richardwei6
richardwei6 / LongJumps.cpp
Created September 21, 2021 04:43
LongJumps.cpp
int solution(vector<int> a) {
int n = a.size();
vector<int> dp(n, 0); // init array of size n to 0
int mx = 0; // find max dp value
for (int i = n - 1; i > -1; i--) { // loop backwards from a
int t = a[i]; // this DP value
@richardwei6
richardwei6 / UIColorHex.swift
Created April 4, 2021 07:11
UIColor Hex Parser
extension UIColor{
convenience init(hex: String, alpha: CGFloat = 1.0){
var hex_copy = hex;
let count = hex.count;
if (count != 6 && count != 7){
self.init();
return;
}
@richardwei6
richardwei6 / udpsocket.swift
Created March 8, 2021 05:53
Native Swift UDP Multicast socket using new iOS 14 network APIs
//
// udpsocket.swift
//
// Created by Richard Wei on 3/7/21.
//
import Foundation
import Network
// https://developer.apple.com/news/?id=0oi77447
//
// AppUtility.swift
// AHS
//
// Created by Richard Wei.
//
import Foundation
import UIKit
struct AppUtility {