Skip to content

Instantly share code, notes, and snippets.

Jonathan Fischer mohiji

Block or report user

Report or block mohiji

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@mohiji
mohiji / AnimatedSpriteComponent.h
Created Mar 17, 2018
Components and delegates
View AnimatedSpriteComponent.h
@import GameplayKit;
@import SpriteKit;
@class AnimatedSpriteComponent;
@protocol AnimatedSpriteComponentDelegate
- (void)animatedSpriteComponent:(AnimatedSpriteComponent *)component didUpdateToFrame:(SKTexture *)frame;
- (void)animatedSpriteComponent:(AnimatedSpriteComponent *)component didCompleteAnimation:(NSString *)animationName;
@mohiji
mohiji / main.lua
Created May 23, 2017
Coroutine test in LÖVE
View main.lua
-- main.lua
-- This file contains the actual demonstration code. The stuff that implements waits and signals
-- is in wait_support.
wait_support = require("wait_support")
local georgeColor = {0, 255, 0, 255}
local bobColor = {255, 0, 255, 255}
local georgeText = ""
@mohiji
mohiji / notes.md
Last active Mar 14, 2017
Notes on "Deploying your first Clojure App from the shadows"
View notes.md

In Chapter 1: Set Up a Server and Deploy a Clojure App to it

  • "anotehr" mis-spelling
  • ansible-galaxy install: the requirements file is in infrastructure/ansible, not just ansible/
  • vagrant up fails:

(silly placeholder to get markdown to do what I want)

solace:infrastructure jfischer$ vagrant up
Bringing machine 'default' up with 'virtualbox' provider...
View GameAllocationThingie.swift
import Foundation
struct Vector3 : Equatable {
let x: Float
let y: Float
let z: Float
func magnitude() -> Float {
return sqrtf(x * x + y * y + z * z)
}
@mohiji
mohiji / Model.java
Created Jul 8, 2016
Really basic immutable models for Java/GWT.
View Model.java
import static com.google.common.base.Preconditions.checkNotNull;
public class ImmutableModel {
private final int id;
private final String label;
public ImmutableModel(int id, String label) {
this.id = id;
this.label = checkNotNull(label);
}
@mohiji
mohiji / StateMachineTests.swift
Created Mar 4, 2016
GameplayKit style state machines in pure Swift
View StateMachineTests.swift
import XCTest
/********************************************
* The state graph used in these tests
*
* StateOne -----> StateTwo -----> State Three
* ^ | ^ |
* | | | |
* -------------| |----------------|
*
@mohiji
mohiji / StateMachines.swift
Created Jul 30, 2015
GKStateMachine in Swift
View StateMachines.swift
//: Playground - noun: a place where people can play
import Cocoa
class State {
weak var stateMachine: StateMachine?
func isValidNextState(stateClass: AnyClass) -> Bool {
return true
}
@mohiji
mohiji / gist:5d652540799ee9c74342
Created Oct 7, 2014
This confuses me. 127.0.0.1 works, localhost doesn't resolve?
View gist:5d652540799ee9c74342
solace:~ jfischer$ curl http://127.0.0.1:4000
Hi there.
solace:~ jfischer$ curl -v http://localhost:4000
* Rebuilt URL to: http://localhost:4000/
* Hostname was NOT found in DNS cache
* Trying ::1...
* connect to ::1 port 4000 failed: Connection refused
* Trying fe80::1...
* connect to fe80::1 port 4000 failed: Connection refused
@mohiji
mohiji / gist:11235244
Created Apr 23, 2014
Removes all non-important whitespace from a JSON file.
View gist:11235244
(require 'st-json)
(defun squish-json-file (filename)
(let ((parsed-json (with-open-file (stream filename)
(st-json:read-json stream))))
(with-open-file (stream (concatenate 'string filename ".squished")
:direction :output
:if-exists :supersede)
(st-json:write-json parsed-json stream))))
@mohiji
mohiji / dupe-detector.m
Created Jan 2, 2014
Got distracted while sorting photos and wrote a thing to help me find duplicate files.
View dupe-detector.m
//
// main.m
// dupe-detector
//
// Created by Jonathan Fischer on 1/1/14.
// Copyright (c) 2014 Jonathan Fischer. All rights reserved.
//
#import <Foundation/Foundation.h>
#import <CommonCrypto/CommonDigest.h>
You can’t perform that action at this time.