Skip to content

Instantly share code, notes, and snippets.

📱
The future is today!

Sidharth Juyal chunkyguy

📱
The future is today!
View GitHub Profile
@chunkyguy
chunkyguy / RxArraySource.h
Created Feb 21, 2020
Rx with ObjectiveC using NSInvocation
View RxArraySource.h
#import "RxObservable.h"
@interface RxArraySource : RxObservable
+ (instancetype)createWithElements: (NSArray *)array;
- (void)subscribe:(NSInvocation *)invocation;
@end
@chunkyguy
chunkyguy / main.swift
Created Nov 26, 2019
A minimal iOS 13 app with no storyboard or xib
View main.swift
import UIKit
// MARK: - ViewController
class ViewController: UIViewController {
override func viewDidLoad() {
super.viewDidLoad()
view.backgroundColor = .red
}
}
@chunkyguy
chunkyguy / ServiceLocator.swift
Last active Nov 19, 2019
Service Locator Pattern with GameplayKit
View ServiceLocator.swift
private class ServiceWrapper<T>: GKComponent {
let service: T
init(service: T) {
self.service = service
super.init()
}
required init?(coder: NSCoder) {
fatalError("init(coder:) has not been implemented")
View cornell_box_scenekit.swift
import Foundation
import SceneKit
import GLKit
class World {
let scene = SCNScene()
func setUp() {
let worldNode = scene.rootNode
addLights(to: worldNode)
View KeyboardHackViewController.swift
//
// ViewController.swift
// KeyboardTransitionBug
//
// Created by Sid on 07/12/2017.
// Copyright © 2017 Picnic. All rights reserved.
//
import UIKit
View Sid.dvtcolortheme
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>DVTConsoleDebuggerInputTextColor</key>
<string>0 0 0 1</string>
<key>DVTConsoleDebuggerInputTextFont</key>
<string>Menlo-Bold - 11.0</string>
<key>DVTConsoleDebuggerOutputTextColor</key>
<string>0 0 0 1</string>
@chunkyguy
chunkyguy / AudioManagerController.h
Last active Sep 30, 2016
How to cross fade between AVAudioPlayers
View AudioManagerController.h
/*
* Hedgewars-iOS, a Hedgewars port for iOS devices
* Copyright (c) 2009-2011 Vittorio Giovara <vittorio.giovara@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; version 2 of the License
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
View mvvm_tableView.swift
import UIKit
struct Album {
let title: String
}
class SwiftAlbumsTableViewController: UITableViewController {
@IBOutlet weak private var activityIndicator: UIActivityIndicatorView!
View QuadTree.h
//
// QuadTree.h
//
// Created by Sid on 24/01/14.
// Copyright (c) 2014 whackylabs. All rights reserved.
//
#ifndef QuadTree_h
#define QuadTree_h
View generic
import UIKit
func clamp<T:Comparable>(value:T, lowerBound:T, upperBound:T) -> T {
return min(max(lowerBound, value), upperBound)
}
func clamp(value:Vector2, lowerBound:Vector2, upperBound:Vector2) -> Vector2 {
return min(max(lowerBound, value), upperBound)
}
You can’t perform that action at this time.