Skip to content

Instantly share code, notes, and snippets.

Avatar
💭
Working on DragonRuby Game Toolkit and RubyMotion

Amir Rajan amirrajan

💭
Working on DragonRuby Game Toolkit and RubyMotion
View GitHub Profile
@amirrajan
amirrajan / preview.md
Created March 20, 2023 04:39
Gameplay demo of The Little Prob
@amirrajan
amirrajan / 00_preview.md
Last active March 12, 2023 18:31
DragonRuby Game Toolkit - Super Hero Shoe Thrower
View 00_preview.md
shoe-thrower-fun-mode.2.MP4
@amirrajan
amirrajan / main.rb
Last active February 22, 2023 21:46
DragonRuby Game Toolkit - AABB + Physics (https://dragonruby.org/toolkit/game)
View main.rb
# https://youtu.be/HQTfqaIxSOA
def tick args
args.state.id_seed ||= 1
args.state.bullets ||= []
args.state.terrain ||= [
{
x: 40, y: 0, w: 1200, h: 40, path: :pixel, r: 0, g: 0, b: 0
},
{
x: 1240, y: 0, w: 40, h: 720, path: :pixel, r: 0, g: 0, b: 0
@amirrajan
amirrajan / example.md
Created February 18, 2023 01:20
Split buffers and zooming in on focus change
View example.md

Demo

splits.mp4

Configuration

(defun amir-zoom-buffer ()
  (interactive)
  (progn
@amirrajan
amirrajan / game_proxy.rb
Created February 15, 2023 20:12
Mildly Interesting RTS - Game Proxy
View game_proxy.rb
class GameProxy
attr_accessor :delegate, :session, :game
def initialize
@peer = MCPeerID.alloc.initWithDisplayName UIDevice.currentDevice.name
@session = MCSession.alloc.initWithPeer @peer
@advertiser = MCAdvertiserAssistant.alloc.initWithServiceType 'MIRTS', discoveryInfo: nil, session: @session
@connected = false
@session.delegate = self
end
@amirrajan
amirrajan / .tmux.conf
Created February 2, 2023 15:32
tmux select pane
View .tmux.conf
unbind 6
unbind 7
unbind 8
unbind 9
unbind 0
bind 6 select-pane -t 1
bind 7 select-pane -t 2
bind 8 select-pane -t 3
bind 9 select-pane -t 4
bind 0 select-pane -t 5
@amirrajan
amirrajan / assert-extensions.cs
Last active January 14, 2023 05:50
C# extension method
View assert-extensions.cs
public static class AssertionExtensions
{
public static void ShouldEqual<T>(this T actual, T expected)
{
Assert.Equal(actual, expected);
}
}
// elsewhere
using AssertionExtensions;
@amirrajan
amirrajan / main.js
Created January 5, 2023 16:54
s3 Multipart Upload Testing
View main.js
// nodejs initialize aws client with api keys, then upload file to s3
const fs = require('fs');
const AWS = require('aws-sdk');
const s3 = new AWS.S3({
accessKeyId: '',
secretAccessKey: ''
});
const uploadFile = async (fileName) => {
@amirrajan
amirrajan / index.html
Last active November 5, 2022 14:30
Drag and drop from w3schools
View index.html
<!DOCTYPE HTML>
<html>
<head>
<style>
#div1 {
width: 350px;
height: 70px;
padding: 10px;
border: 1px solid #aaaaaa;
}
@amirrajan
amirrajan / main.rb
Created October 9, 2022 01:27
A Car That Turns - Input Function
View main.rb
class Game
attr_gtk
def input_game
return if state.scene != :game
if inputs.mouse.click && (inputs.mouse.intersect_rect? state.review_button_rect)
state.next_scene = :review
end