Skip to content

Instantly share code, notes, and snippets.

View drhayes's full-sized avatar
🐱

David Hayes drhayes

🐱
View GitHub Profile
@josephg
josephg / main.lua
Created October 7, 2016 04:21
Pretty love2d particles
local graphics = love.graphics
local TAU = math.pi * 2
local p, pe
local MS=1
local PSIZE=40
function love.load()
graphics.setDefaultFilter('linear', 'linear', 4)
@xem
xem / readme.md
Last active May 11, 2024 23:57
Maths & trigonometry cheat sheet for 2D & 3D games

Conventions

  • A = [xA, yA] is a point on the 2D plane. Same for B, C, ...
  • lengths are in any unit (ex: pixels)
  • code snippets are in JavaScript

Degrees to radians

angleRad = angleDeg * Math.PI / 180;

@rauchg
rauchg / README.md
Last active January 6, 2024 07:19
require-from-twitter
let noop = function() {
};
export default class ArcadeController {
static factory(moveStartCallback, moveCallback, fireCallback, cbContext) {
return new Phaser.ArcadeController(this.game, moveStartCallback, moveCallback, fireCallback, cbContext)
}
constructor(game, moveStartCallback = noop, moveCallback = noop, fireCallback = noop, callbackContext) {
game.input.holdRate = 150;
game.input.touch.consumeDocumentTouches();
@hdml
hdml / - Syncthing + start on boot.md
Last active November 22, 2023 19:26
How to install Syncthing on Raspberry Pi + start on boot [semi-automatic]

##Run install_syncthing.sh

$ curl -s https://gist.githubusercontent.com/hdml/7b079c114d3e20bf69f1/raw/1cd3647b1db4f80726c145fba725e27993a7fcdb/install_syncthing.sh | sudo bash

Start syncthing

$ syncthing

Wait until you get something like:

@julianlam
julianlam / expose-directory-on-host-to-lxc-container.md
Last active May 22, 2024 15:15
Exposing a directory on the host machine to an LXC container #blog

Exposing a directory on the host machine to an LXC container

  1. Log into the container and create an empty directory, this will be the mount point
  2. Log out and stop the container.
  3. Open to your container's config file
    • For regular LXC containers: /var/lib/lxc/mycontainer/config
    • For unprivileged LXC containers: $HOME/.local/share/lxc/mycontainer/config
  4. Add a new line above the lxc.mount directive, that follows the format below. Substitute proper paths as necessary:
    • lxc.mount.entry = /path/to/folder/on/host /path/to/mount/point none bind 0 0
  • Both of these paths are relative to the host machine.
@ericelliott
ericelliott / essential-javascript-links.md
Last active May 17, 2024 03:38
Essential JavaScript Links
@duanefields
duanefields / AngularController.coffee
Last active June 8, 2016 00:55
CoffeeScript Base Classes for AngularJS
module.exports = class AngularController
# register the subclass with angular, module and name are optional
@register: (name, module) ->
module ?= @module || angular.module 'controllers'
name ?= @name || @toString().match(/function\s*(.*?)\(/)?[1]
module.controller name, @
# inject the list of dependencies, as a list of Strings
@inject: (args...) ->
@tylerneylon
tylerneylon / json.lua
Last active May 15, 2024 12:57
Pure Lua json library.
--[[ json.lua
A compact pure-Lua JSON library.
The main functions are: json.stringify, json.parse.
## json.stringify:
This expects the following to be true of any tables being encoded:
* They only have string or number keys. Number keys must be represented as
strings in json; this is part of the json spec.
@addyosmani
addyosmani / README.md
Last active April 2, 2024 20:18 — forked from 140bytes/LICENSE.txt
108 byte CSS Layout Debugger

CSS Layout Debugger

A tweet-sized debugger for visualizing your CSS layouts. Outlines every DOM element on your page a random (valid) CSS hex color.

One-line version to paste in your DevTools

Use $$ if your browser aliases it:

~ 108 byte version