Skip to content

Instantly share code, notes, and snippets.

@vinczebalazs
vinczebalazs / SheetModalPresentationController.swift
Last active January 9, 2023 23:02
SheetModalPresentationController.swift
import UIKit
final class SheetModalPresentationController: UIPresentationController {
// MARK: Private Properties
private let isDismissable: Bool
private let interactor = UIPercentDrivenInteractiveTransition()
private let dimmingView = UIView()
private var propertyAnimator: UIViewPropertyAnimator!
@alexanderwe
alexanderwe / Firebase+Combine.swift
Created January 27, 2020 15:30
Firebase + Combine
import Firebase
import Combine
// MARK: - CollectionReference
public struct CombineFIRCollection {
fileprivate let collection: CollectionReference
}
extension CombineFIRCollection {
@j-j-m
j-j-m / commonprofile.metal
Created May 8, 2017 00:20
Can't access GL Uniforms in Metal shader modifier? Apple docs for SCNShadable written in terms of GL? Pulling your hair out?... this will help.
////////////////////////////////////////////////
// CommonProfile Shader v2
#import <metal_stdlib>
using namespace metal;
#ifndef __SCNMetalDefines__
#define __SCNMetalDefines__
--given a 2D table "tiles" with a cell for each tile on the ground, and each cell containing a list of objects
--in that cell,find all cells which are in line of sight between points A and T
--s is cellsize (square)
--tiles is a 2D table
--results will be passed back in a table
--so if tile[3][4] is in line of sight, then (whatever is in) tiles[3][4] will be added to the results
function GetTiles(T,A,s,tiles)
local x0,y0,x1,y1=T.x/s,T.z/s,A.x/s,A.z/s --tile positions of the two points
local dx = abs(x1-x0)
local dy = abs(y1-y0)
@moxuse
moxuse / GameViewController.swift
Last active February 13, 2022 21:24
SCNShadable Shader Modifiers Test
import SceneKit
import QuartzCore
class GameViewController: NSViewController {
@IBOutlet weak var gameView: GameView!
override func awakeFromNib(){
let numSphere = 10
@rmcgibbo
rmcgibbo / github_comment_on_commit.py
Created August 23, 2012 07:22
Jenkins setup to automatically comment on github commits with build status
// Using the Jenkins Groovy Post build plugin to execute the following after every build
// https://wiki.jenkins-ci.org/display/JENKINS/Groovy+Postbuild+Plugin
// It would be nice not to have to specify these here... the repo name should be available within the hudson
// api somehow, but I didn't know how to get it. The access token should maybe be saved in a config file, and
// read in at runtime?
GITHUB_REPO_NAME = 'myusername/myreponame'
GITHUB_ACCESS_TOKEN = 'my_github_api_v3_access_token'