Skip to content

Instantly share code, notes, and snippets.

View antonmills's full-sized avatar

Anton Mills antonmills

View GitHub Profile
@antonmills
antonmills / gist:3818959
Created October 2, 2012 13:07
Canvas work with TypeScript (image.onload now using a Lambda for scope)
/**
* class manages drawing to a canvas
* @author antonmills. (http://www.antonmills.com / http://www.twitter.com/antonmill)
*/
class MapController {
// privates (hehe ;p)
private _canvas; // the render target
private _image; // the source image
private _ctx; // ctx
var MapController = (function () {
function MapController(canvas, imagePath) {
this.canvas = canvas;
this.imagePath = imagePath;
this._canvas = canvas;
this._canvas.width = 960;
this._canvas.height = 640;
this._ctx = this._canvas.getContext('2d');
this._that = this;
this._image = new Image();
@antonmills
antonmills / gist:5939516
Created July 6, 2013 10:33
For scrolling a Box2D world. Remember, you've given Box2D a sprite to render to, all you need to do is offset that sprite.
_canvas.style.position = "absolute";
_canvas.style.left = "" + -(_car.GetWorldCenter().x * worldScale) + "px";
@antonmills
antonmills / isConvex
Created August 31, 2014 10:32
Detect if poly is convex or concave
/**
* Tests if a Polygon shape is convex.
* Pass an Array of vertices(or points) that have x/y properties
*
* @return {Boolean} true is a convex shape
*/
Polygon.prototype.isConvex = function()
{
if (this.vertices.length < 4)
return true;
@antonmills
antonmills / react-bootstrap
Last active November 2, 2017 23:23
issue with refresh
import React, { Component } from 'react';
import { BrowserRouter as Router, Route, Link } from 'react-router-dom';
import ReactDOM from 'react-dom';
import { Button, Jumbotron, Form, Col, FormGroup, FormControl, ControlLabel, InputGroup, Overlay, Tooltip, Popover } from 'react-bootstrap';
class ViewHome extends Component {
constructor(props) {
super(props);
@antonmills
antonmills / cloudSettings
Last active January 29, 2020 10:19
vscode
{"lastUpload":"2020-01-29T10:19:40.195Z","extensionVersion":"v3.4.3"}
@antonmills
antonmills / gist:8d5cf7835e9ca6b375a1fb172daa742a
Created October 25, 2025 04:25
Podman Socket / Autostart
To start the Podman user socket
systemctl --user start podman.socket
To make it auto-start on login:
systemctl --user enable podman.socket
Then confirm it’s running:
systemctl --user status podman.socket