Skip to content

Instantly share code, notes, and snippets.

View jlott1's full-sized avatar

Jonathan Lott jlott1

View GitHub Profile
@jfuellert
jfuellert / ScrollableView.swift
Last active October 10, 2024 00:30
A scrollable SwiftUI view, UIScrollView wrapper. ScrollableView lets you read and write content offsets for scrollview in SwiftUI, with and without animations.
import SwiftUI
struct ScrollableView<Content: View>: UIViewControllerRepresentable, Equatable {
// MARK: - Coordinator
final class Coordinator: NSObject, UIScrollViewDelegate {
// MARK: - Properties
private let scrollView: UIScrollView
var offset: Binding<CGPoint>
@minhlucvan
minhlucvan / App.js
Last active October 12, 2023 03:58
react native org chart
import React, { Component } from 'react';
import { Platform, StyleSheet, Text, View } from 'react-native';
import OrgChart from './Orgchart';
import NodeComponent from './NodeComponent';
const instructions = Platform.select({
ios: 'Press Cmd+R to reload,\n' + 'Cmd+D or shake for dev menu',
android: 'Double tap R on your keyboard to reload,\n' + 'Shake or press menu button for dev menu',
});
@ozalexo
ozalexo / ContentView.swift
Created October 24, 2019 04:42
SwiftUI: ScrollView pager
//
// ContentView.swift
// PaginatedScrollView
//
// Created by Aleksey Ozerov on 24.10.2019.
// Copyright © 2019 Aleksey Ozerov. All rights reserved.
//
import SwiftUI
@Amzd
Amzd / Binding+didSet.swift
Last active September 20, 2023 05:27
SwiftUI Binding wrappers for willSet and didSet
extension Binding {
/// Wrapper to listen to didSet of Binding
func didSet(_ didSet: @escaping ((newValue: Value, oldValue: Value)) -> Void) -> Binding<Value> {
return .init(get: { self.wrappedValue }, set: { newValue in
let oldValue = self.wrappedValue
self.wrappedValue = newValue
didSet((newValue, oldValue))
})
}
@jojosati
jojosati / appsscript.json
Last active March 27, 2023 20:26
MongoDB connector for Google Data Studio
{
"exceptionLogging": "STACKDRIVER",
"dataStudio": {
"name": "MongoDB via mlab API - acc40",
"company": "Account 4.0",
"companyUrl": "https://acc40.com",
"logoUrl": "https://next-scraft.appspot.com/images/scraft.ico",
"addonUrl": "https://medium.com/@jsat66/mongodb-connector-for-google-data-studio-part-1-%E0%B8%AA%E0%B8%B3%E0%B8%A3%E0%B8%A7%E0%B8%88-c35eac7f2bf4",
"supportUrl": "https://gist.github.com/jojosati/89652770b39fd147a2484e4baf13a5ee",
"description": "Universal MongoDB connector."
@kenthumphries
kenthumphries / embed-debug-only-framework.sh
Last active October 20, 2023 14:10
Script to be called as part of an Xcode Run Script build phase. This will ensure that script Input File is copied (and code signed) to script Output File.
#!/bin/sh
# This script embeds (and codesigns) a framework within an iOS app binary, but only when the configuration is Debug.
# It must be called from, or copied into an Xcode Run Script build phase with following setup:
# Input Files:
# - Path to framework within project folder (source path)
# - For example: $(SRCROOT)/ThirdPartyFrameworks/SimulatorStatusMagiciOS.framework
# Output Files:
# - Desired path to framework within ${BUILT_PRODUCTS_DIR}/${FRAMEWORKS_FOLDER_PATH} (destination path)
# - For example: ${BUILT_PRODUCTS_DIR}/${FRAMEWORKS_FOLDER_PATH}/SimulatorStatusMagiciOS.framework
@mygoare
mygoare / b.js
Created November 24, 2017 11:11
busboy upload file, socketio update the progress
var Busboy = require('busboy');
var AWS = require('aws-sdk');
var socket = require('socket.io');
var express = require('express');
var http = require('http');
// Set up Express
var app = express();
var server = http
.Server(app)
@jcamp
jcamp / video-editors-opensource.md
Last active November 14, 2024 19:29
OpenSource Video Editors
@matsuda
matsuda / memoryAddress.swift
Last active October 10, 2024 04:39
Get memory address in Swift
///
/// https://stackoverflow.com/a/29741007
///
let s = Struct() // Struct
withUnsafePointer(to: s) {
print(String(format: "%p", $0)
}
///
/// http://stackoverflow.com/a/36539213/226791
@mats-claassen
mats-claassen / UserInfoCell.swift
Last active September 29, 2021 13:39
Example of an Eureka custom row
//
// UserInfoCell.swift
//
// Created by Mathias Claassen on 30/8/16.
// Copyright © 2016 Xmartlabs. All rights reserved.
//
import Foundation
import Eureka