Skip to content

Instantly share code, notes, and snippets.

💭
Working on a Ruby runtime for building apps and games 🎉 :wq

Amir Rajan amirrajan

💭
Working on a Ruby runtime for building apps and games 🎉 :wq
View GitHub Profile
View sprite_limit.rb
class Star
attr_sprite
def initialize
@x = (1280 * rand) * -1
@y = (720 * rand) * -1
@s = 1 + rand * 3
@w = 16
@h = 16
@path = "sprites/star.png"
@amirrajan
amirrajan / .tmux.conf
Last active Jun 9, 2020
My tmux config: ~/.tmux.conf
View .tmux.conf
# ~/.tmux.conf
# * brew install tmux reattach-to-user-namespace
# * C-a - Your leader <l> key.
# * <l>: - Type command not handled by shortcut keys. Eg: <l>: kill-pane ENT
# * <l>r - Reload this file/config.
# * <l>j - Select split using number jump list.
# * <l>{ - Swap splits left.
# * <l>} - Swap splits right.
# * <l>| - Create vertical split.
# * <l>- - Create orizontal split.
@amirrajan
amirrajan / test-tutorial.html
Last active May 29, 2020
Sample starting point for a tutorial:
View test-tutorial.html
<html>
<head>
<!--
To run tutorial interactively, go to the raw output for this file and use that as the "tutorial="
querystring parameter. For example:
http://fantasyconsole.dragonruby.org.s3-website.us-east-2.amazonaws.com/?tutorial=https://gist.githubusercontent.com/amirrajan/18f1a1078976705de2bc75489311210c/raw/6f48a091e869b3f37979a2b450874c9d136a1c20/test-tutorial.html
-->
<title>DragonRuby - NAME OF TUTORIAL</title>
</head>
<body>
@amirrajan
amirrajan / faq.md
Created May 18, 2020
DragonRuby FAQ (work in progress)
View faq.md

DragonRuby Frequently - Asked Questions, Comments, and Concerns

Here are questions, comments, and concerns that frequently come up.

Frequently Asked Questions

What is DragonRuby LLP?

DragonRuby LLP is a partnership of four devs who came together

@amirrajan
amirrajan / main.c
Last active May 15, 2020
Calling objc from c.
View main.c
#include <objc/objc.h>
#include <objc/runtime.h>
#include <objc/message.h>
#include <objc/objc-auto.h>
void hello_world()
{
/* Objective C
id le_string = [[NSString alloc] initWithCString: "hello world", NSUTF8StringEncoding];
unichar character = [le_string characterAtIndex: 0];
@amirrajan
amirrajan / main.rb
Last active May 15, 2020
bouncy circle
View main.rb
class Game
attr_gtk
def tick
fiddle
defaults
render
input
calc
end
@amirrajan
amirrajan / Rakefile
Last active May 14, 2020
An auto runner script for Mac
View Rakefile
task :default do
puts 'hello world'
end
task :test do
puts 'running test'
end
task :ancillary do
puts 'ancillary'
View aspect-ratio.md
+------------+-------+------+------+------+------+------+------+------+------+
| Resolution | @Name | Unit |  720 | 1080 | 1440 |   4K |   5K |   6K |   8K |
+------------+-------+-----:+-----:+-----:+-----:+-----:+-----:+-----:+-----:+
| 1280x720   | 720p  |  2px |   1x |    - |    - |    - |    - |    - |    - |
| 1920x1080  | 1080p |  3px | 1.5x |   1x |    - |    - |    - |    - |    - |
| 2560x1440  | 1440p |  4px |   2x |    - |   1x |    - |    - |    - |    - |
| 3840x2160  | 4K    |  6px |   3x |   2x |    - |   1x |    - |    - |    - |
| 5120x2880  | 5K    |  8px |   4x |    - |   2x |    - |   1x |    - |    - |
| 5760x3240  | 6K    |  9px | 4.5x |   3x |    - |    - |    - |   1x |    - |
View tmux.conf
set -g mouse on
set -g prefix C-a
set -g display-time 4000
set -g display-panes-time 4000
bind a send-prefix
unbind C-b
unbind C-m
unbind C-a
unbind C-j
unbind C-l
@amirrajan
amirrajan / 1000_needles.cs
Last active May 4, 2020
Nationalize extension method.
View 1000_needles.cs
// ToDictionary
var dictionary = new {
town0 = "Downtown",
townCommunityFarm = "Community Farm"
}.ToDictionary<string>();
// ValueOrDefault
dictonary.ValueOrDefault("someKey") ?? new SomeClass();
// Each
You can’t perform that action at this time.