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 / 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.

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 / .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`.
@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;
@AtkinsSJ
AtkinsSJ / export_icons.bat
Last active August 29, 2015 14:27
Windows Batch File for generating drawable PNGs from SVG files using Inkscape.
setlocal EnableDelayedExpansion
@echo off
set sizes[m]=24
set sizes[h]=36
set sizes[xh]=48
set sizes[xxh]=72
set sizes[xxxh]=96
for %%f in (.\svg\*.svg) do (
@AtkinsSJ
AtkinsSJ / night.fragment.glsl
Created September 18, 2014 15:07
Problematic shader code
#ifdef GL_ES
precision mediump float;
#endif
varying vec4 v_color;
varying vec2 v_texCoords;
uniform sampler2D u_texture;
uniform vec3 u_playerPosition;
uniform float u_playerLightRangeScaled;
@AtkinsSJ
AtkinsSJ / Alternative, for ShaderToy.
Last active August 29, 2015 14:06
Basic shader that makes things dark and blueish. The Vertex shader is just a generic one. The fragment shader gets the lightness of the pixel at the right place on the texture, darkens it, and gives it a blue tint.
float lightDistance = 100.0;
void main(void)
{
vec2 uv = gl_FragCoord.xy / iResolution.xy;
uv.y = iResolution.y - uv.y;
vec4 tex = texture2D(iChannel0, uv);
// How far are we from the mouse?
float mouseDist = distance(gl_FragCoord.xy, iMouse.xy);
@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;
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 / 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;