Skip to content

Instantly share code, notes, and snippets.

View JohannMG's full-sized avatar
🐺

Johann Garces JohannMG

🐺
View GitHub Profile
@JohannMG
JohannMG / HashableBisector.swift
Created April 21, 2022 23:23
Quick little bisector in swift for hashable items for the case when you're not bisecting a linear list.
//
// HashableBisector.swift
// TestHashableBisector
//
// Created by Johann Garces on 4/21/22.
//
import Foundation
enum BisectorState : Equatable {
@JohannMG
JohannMG / PasswordRequirementsView.swift
Created October 30, 2021 22:26
Made this view in UIKit before and remade in SwiftUI. Lets you create a set of parameters to show to the user to visually identify if they have a password that will pass requirements.
//
// PasswordRequirementsView.swift
// SwiftUiPlayground
//
// Created by Johann Garces on 10/30/21.
//
/*
* Made this view in UIKit before and remade in SwiftUI.
* Lets you create a set of parameters to show to the user to visually identify
@JohannMG
JohannMG / FirtDraggableLabel.swift
Created October 17, 2021 22:23
Quick test on adding subview to the window. We are making a label that when tapped creates a second dragging label. The dragging label is moveable around the screen. Then when you release the dragging view is removed and the label is updated.
/*
FirtDraggableLabel, October 2021
Quick test on adding subview to the window.
We are making a label that when tapped creates a second dragging label.
The dragging label is moveable around the screen.
Then when you release the dragging view is removed and the label is updated.
This project is also me remembering how UIKit UIWindows work.
As well as adding subviews directly to UIWindows.
@JohannMG
JohannMG / Quick_Selectors_Overview.txt
Created October 12, 2021 16:59
I taught a quick class on how objective C selectors work
objective-c selectors:
SEL
The alternative to blocks.
This is how delegate/protocol patterns work. (another talk)
Most common API is for UIButtons / UIControls
[button addTarget:self action:@selector(aMethod:) forControlEvents:UIControlEventTouchDown];
-(void)aMethod:(UIButton*)sender
Calls the selector on the target.
@JohannMG
JohannMG / Main.cpp
Created September 24, 2020 03:46
Confirm: Can use array with const char* to have a sub array of other const char* to fill a QMap
#include <QCoreApplication>
#include <QMap>
#include <QMapIterator>
#include <QDebug>
using StringIntMap = QMap<const char*, int>;
void addToMap(StringIntMap &map, const char* key, int value)
{
map[key] = value;
@JohannMG
JohannMG / main.cpp
Created September 24, 2020 03:40
Confirm: You can iterate through array of char pointers.
#include <QCoreApplication>
#include <QMap>
#include <QMapIterator>
#include <QDebug>
using StringIntMap = QMap<const char*, int>;
void addToMap(StringIntMap &map, const char* key, int value)
{
map[key] = value;
@JohannMG
JohannMG / main.cpp
Created September 24, 2020 03:36
Confirm: Passing QMap reference to helper function edits the same QMap.
#include <QCoreApplication>
#include <QMap>
#include <QMapIterator>
#include <QDebug>
using StringIntMap = QMap<const char*, int>;
void addToMap(StringIntMap &map, const char* key, int value)
{
map[key] = value;
@JohannMG
JohannMG / main.cpp
Created September 23, 2020 02:21
Test if QMap sorts strings by alphabetical order ( Yes it Does
#include <QCoreApplication>
#include <QDebug>
#include <QMap>
int main(int argc, char *argv[])
{
QCoreApplication a(argc, argv);
@JohannMG
JohannMG / main.cpp
Created March 3, 2020 01:19
Testing URL Parsing for Base64 URL Query Parameters in Node and Qt Framework using QUrl abd QUrlQuery
#include <QCoreApplication>
#include <QUrl>
#include <QDebug>
#include <QUrlQuery>
#include <QPair>
#include <QString>
int main(int argc, char *argv[])
{
QCoreApplication a(argc, argv);
@JohannMG
JohannMG / SnipClip.py
Last active November 8, 2019 20:43
Friend asked me how we could do a live stream with the Live but not the "stream": there was little to no reliable internet connection. I wrote this in a few hours
from moviepy.editor import VideoFileClip
from moviepy.video.io.ffmpeg_tools import ffmpeg_extract_subclip
import os.path
import sys
import time
import math
import ffmpy
'''