Skip to content

Instantly share code, notes, and snippets.

View chunkyguy's full-sized avatar

Sidharth Juyal chunkyguy

View GitHub Profile
//
// ViewController.swift
// KeyboardTransitionBug
//
// Created by Sid on 07/12/2017.
// Copyright © 2017 Picnic. All rights reserved.
//
import UIKit
@chunkyguy
chunkyguy / Sid.dvtcolortheme
Created November 2, 2016 15:50
Xcode color theme
<?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 October 21, 2023 21:06
How to cross fade between AVAudioPlayers
/*
* 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
@chunkyguy
chunkyguy / mvvm_tableView.swift
Created June 27, 2015 08:28
MVVM for UITableView
import UIKit
struct Album {
let title: String
}
class SwiftAlbumsTableViewController: UITableViewController {
@IBOutlet weak private var activityIndicator: UIActivityIndicatorView!
@chunkyguy
chunkyguy / QuadTree.h
Created April 1, 2015 11:09
Quad Tree
//
// QuadTree.h
//
// Created by Sid on 24/01/14.
// Copyright (c) 2014 whackylabs. All rights reserved.
//
#ifndef QuadTree_h
#define QuadTree_h
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)
}
#include <iostream>
struct Vector2 {
float x;
float y;
Vector2(float x = 0, float y = 0) {
this->x = x;
//
// AsyncLoading.cpp
//
// Created by Sid on 11/10/14.
// Copyright (c) 2014 whackylabs. All rights reserved.
//
// Context: http://www.reddit.com/r/gamedev/comments/2ivsp6/async_loading_and_syncing_threads_with_your/
/** Output:
@chunkyguy
chunkyguy / wl_texture_atlas_format
Created August 25, 2014 03:54
Texture Atlas format for use in an upcoming game engine. This format works with Zwoptex.app
<?xml version="1.0" encoding="UTF-8"?>
<TextureAtlas>
<meta>
<textureName>{{ metadata.target.textureFileName }}</textureName>
<textureExtension>{{ metadata.target.textureFileExtension }}</textureExtension>
<textureSize>{{ metadata.size }}</textureSize>
</meta>
<SubTextures>
{% for sprite in spritesAndAliases %}
<SubTexture>
/** Log execution time of a block of code in nanoseconds and milliseconds
* Just add a Timer object at the start of the code block.
* Provide a prefix string about some context
*
* Example:
* long LargestPrimeFactor(const long num)
* {
* Timer t("LargestPrimeFactor:(" + std::to_string(num) + ") ");
* //stuff here..
* }