Skip to content

Instantly share code, notes, and snippets.

View AtkinsSJ's full-sized avatar
🦡
That's the badger!

Sam Atkins AtkinsSJ

🦡
That's the badger!
View GitHub Profile
@AtkinsSJ
AtkinsSJ / AIDriver.java
Created May 16, 2013 20:25
For some reason, the Java code I'm working on crashes, as a class tries to find itself. Line 43 of AIDriver.java defines a RayCastCallback, and this for some reason causes a class loader to search for "uk.co.samatkins.racing.drivers.AIDriver$MoveCalculator$1", which I think is the RayCastCallback itself. Any ideas?
package uk.co.samatkins.racing.drivers;
import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.math.Vector2;
import com.badlogic.gdx.physics.box2d.Fixture;
import com.badlogic.gdx.physics.box2d.RayCastCallback;
import com.badlogic.gdx.physics.box2d.World;
import uk.co.samatkins.racing.Car;
import uk.co.samatkins.racing.Move;
@AtkinsSJ
AtkinsSJ / gist:5611633
Created May 20, 2013 11:04
Things that cause box2d to crash. Most of these are things you shouldn't do in your code anyway, but it'd be better if it gave an error rather than just crash with no explanation. >_<
  • Creating or destroying bodies and fixtures during a callback.
  • Casting a ray where the start and end points are the same position.
  • Creating a fixture with a PolygonShape set as a box with 0 width and height
@AtkinsSJ
AtkinsSJ / 1gam.php
Created May 31, 2013 16:10
Scraper for #1GAM games. Grabs the information from http://www.onegameamonth.com/gameslist and generates a csv file. Because of how the #1GAM site is set-up, this only gets the entries for the current month. Hopefully there will be an official API at some point.
<?php
error_reporting(E_ALL ^ E_NOTICE);
$url = 'http://www.onegameamonth.com/gameslist';
$games = array();
function addGame($gameDiv) {
$game = array();
$ga = $gameDiv->firstChild;
private HashMap<String, String> tracks;
// ...
tracks = new HashMap<String, String>();
tracks.put("Dumb Loop", "track1.svg");
tracks.put("Dumb Loop 2", "track1.svg");
tracks.put("Dumb Loop 3", "track1.svg");
tracks.put("All these are the same", "track1.svg");
@AtkinsSJ
AtkinsSJ / MapGenerator.java
Created July 1, 2013 21:04
The map generation code from Beard of Bees.
package uk.co.samatkins.beebeard;
import java.util.List;
import com.badlogic.gdx.math.MathUtils;
import com.badlogic.gdx.math.Rectangle;
import uk.co.samatkins.Tilemap;
import uk.co.samatkins.beebeard.PlayScene.Tile;
@AtkinsSJ
AtkinsSJ / DatabaseInfo.java
Last active October 6, 2016 11:03
Java code generation attempt
package uk.co.samatkins.windowcleaningassistant;
import android.content.ContentValues;
import android.database.Cursor;
import android.net.Uri;
import android.os.Parcel;
import android.os.Parcelable;
import android.provider.BaseColumns;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;

New Path class

Paths may be arbitrary sequences of bytes, so we cannot guarantee that they are utf8 or even convertible to utf8 and back. However, we do want to be able to convert the path to utf8, and vice versa.

  • LexicalPath currently deals with manipulating paths and getting their parts. Do we roll this into Path?
  • Core::Directory deals with iteration, stat and open. Do we roll this into Path?
  • Core::DeprecatedFile has methods for other filesystem checks and operations. Do we roll this into Path?
  • Core::StandardPaths provides getters for the home directory path, and friends. Do we roll this into Path?

Rust has a Path class for a path, allowing you to access its components and query if it's a directory etc; and PathBuf class as a kind of StringBuilder thing?

@AtkinsSJ
AtkinsSJ / Ladybird-GTK-icon.svg
Created August 24, 2023 15:53
Ladybird-GTK-icon.svg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@AtkinsSJ
AtkinsSJ / .gitconfig
Last active February 25, 2024 15:02
My Git settings and aliases
[user]
# ...
[alias]
# Note: This assumes two remotes:
# - origin: My fork
# - upstream: The "main" repo
#
# Also, the name of the main branch (usually "master" or "main") is read from the `var.master-branch` git config var.
# It defaults to "master". Change it for the current repo with `git config --local var.master-branch BRANCH_NAME_HERE`.