Skip to content

Instantly share code, notes, and snippets.

View jameszaghini's full-sized avatar

James Zaghini jameszaghini

View GitHub Profile
@amirrajan
amirrajan / main.rb
Last active March 25, 2025 16:57
DragonRuby Game Toolkit Sprite Sheet Example
def tick args
args.labels << [640, 689, "Asset Presenter", 0, 1]
args.sprites << tile(0, 0, 100, 100)
args.sprites << tile(1, 0, 200, 200)
args.sprites << tile(2, 0, 300, 300)
10.map_with_index do |x|
10.map_with_index do |y|
args.sprites << tile(x, y, 30 + x * 64, 30 + y * 64)
end
@correia
correia / swift-kvo-example.swift
Last active April 16, 2023 02:38
A quick example for how to use Foundation style KVO from Swift. (Official documentation from Apple is forthcoming.)
//
// Swift-KVO
//
// Created by Jim Correia on 6/5/14.
// Copyright (c) 2014-2015 Jim Correia. All rights reserved.
//
// Update: 6/17/2014
//
// KVOContext has gone away; use the same idiom you'd use from Objective-C for the context
//
@tyrone-sudeium
tyrone-sudeium / gist:4594251
Last active December 11, 2015 11:29
A horizontally paging, but vertically-flowing UICollectionViewFlowLayout. Oddly, gists don't let you enter markdown into the description, so see the comment below for a description of what it does. Make sure you set its flow direction to **vertical**, even though it'll page horizontally.
@interface HorizontallyPagingCollectionViewFlowLayout : UICollectionViewFlowLayout
@end
@implementation HorizontallyPagingCollectionViewFlowLayout
- (CGSize) collectionViewContentSize
{
CGSize superSize = [super collectionViewContentSize];
CGSize frameSize = self.collectionView.frame.size;