Skip to content

Instantly share code, notes, and snippets.

View dannypage's full-sized avatar
https://danny.page

Danny Page dannypage

https://danny.page
View GitHub Profile
@braidn
braidn / Dockerfile
Last active June 27, 2020 22:08
Crystal Devcontainer
ARG VARIANT="20.04"
FROM mcr.microsoft.com/vscode/devcontainers/base:0-ubuntu${VARIANT}
RUN apt-get update && \
apt-get install -y build-essential curl libevent-dev libssl-dev libxml2-dev libyaml-dev libgmp-dev git && \
apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
RUN curl -sL "https://keybase.io/crystal/pgp_keys.asc" | apt-key add - && \
echo "deb https://dist.crystal-lang.org/apt crystal main" | tee /etc/apt/sources.list.d/crystal.list && \
apt-get update
@dhh
dhh / Gemfile
Created June 24, 2020 22:23
HEY's Gemfile
ruby '2.7.1'
gem 'rails', github: 'rails/rails'
gem 'tzinfo-data', '>= 1.2016.7' # Don't rely on OSX/Linux timezone data
# Action Text
gem 'actiontext', github: 'basecamp/actiontext', ref: 'okra'
gem 'okra', github: 'basecamp/okra'
# Drivers
@mikepqr
mikepqr / README.md
Last active September 27, 2021 04:19
Make printouts from Firefox Reader mode look like NYRB artices

printout with this stylesheet

See this tweet for how I use this.

To install in Firefox:

  1. If it doesn't already exist, create a folder called chrome in your profile folder. The easiest way to find your profile folder is in about:profiles (there's a "Show in Finder" link for the folder on macOS). Be sure to choose the right profile is you have more than one.

  2. Put userContent.css above in the chrome folder you just created.

@amirrajan
amirrajan / pong.rb
Last active August 28, 2019 13:53
Pong in DragonRuby Game Toolkit
def tick args
defaults args
render args
calc args
input args
end
def defaults args
args.state.ball.debounce ||= 3 * 60
args.state.ball.size ||= 10
class Game
attr_accessor :args, :state, :inputs, :outputs, :grid
def update_line_of_sight
variations = [-1, 0, 1]
newly_visible = variations.product(variations).flat_map do |rise, run|
thick_line_of_sight state.x, state.y, rise, run, 15,
lambda { |x, y| dungeon_cell_exists? x, y }
end.uniq
@icculus
icculus / basicgorillas.rb
Last active June 21, 2023 02:10
DragonRuby Basic Gorillas
# This is the complete source code to Basic Gorillas:
# https://dragonruby.itch.io/basicgorillas
#
# You can tinker with this by getting a copy of DragonRuby Game Toolkit:
# https://dragonruby.org/
#
# Amir Rajan wrote this game, catch him at https://twitter.com/amirrajan !
class YouSoBasicGorillas
attr_accessor :outputs, :grid, :game, :inputs
# This is the complete source code to Flappy Dragon:
# https://dragonruby.itch.io/flappydragon
#
# You can tinker with this by getting a copy of DragonRuby Game Toolkit:
# https://dragonruby.org/
#
# Amir Rajan wrote this game, catch him at https://twitter.com/amirrajan !
class FlappyDragon
attr_accessor :grid, :inputs, :game, :outputs
@wndxlori
wndxlori / main.rb
Last active May 8, 2019 21:53
DragonRuby Game Toolkit Tutorial - Galaga clone...a new beginning
# the first 2 or 4 values of the primitive conventionally are x, y, (w, h, or x2, y2)
# the last 4 values conventionally are r, g, b, a (color)
# custom values for primitive are in the middle
# labels x, y, text, size, alignment, r, g, b, a
# sprites x, y, w, h, path, angle, alpha
# lines x, y, x1, y1, r, g, b, a
# solids x, y, w, h, r, g, b, a
# borders x, y, w, h, r, g, b, a
# sounds ".wav|.ogg"
@amirrajan
amirrajan / mod.rb
Last active May 8, 2019 21:53
subspace2.rb
# Press escape the open up the DragonRuby Hud and type the following code
def after_tick game_state
game_state.solids << [0, 0, 100, 100, 255, 0, 0]
end
# after typing the code above press Shift+Enter
@FuzzySlipper
FuzzySlipper / JsonDB.cs
Created September 18, 2018 20:23
Runtime CastleDB file reader
using UnityEngine;
using System.Collections;
using System.Collections.Generic;
using SimpleJSON;
namespace PixelComrades {
public class JsonDB {
private const string Id = "ID";
private const string EnumProp = "hasIndex";