All code is available in example app - https://github.com/maxivak/webpacker-rails-example-app
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
https://twitter.com/_mdymkowski/status/1371476003789361153 | |
def tick a | |
B=a.outputs[:r].solids<<[A=0,0,1e2,1e4,F=255,F,F] | |
a.solids<<[0,0,2e3,1e3,0,0,0] | |
a.sprites<<http://960.map{[638,360,w=($i+=3).sin*F*1.5,h=$i.sin*F,:r,A+=3,5,F*w,-F*(w+h),-F*h]}; | |
$i+=1; | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
DragonRuby C Extension Pixel Array | |
Written by @Akzidenz-Grotesk (with help from @AlexDenisov & @Kenneth | CANICVS) | |
Demonstrates some quick and pretty dirty image filters | |
Loads image files into Pixel Array | |
Performs image manipulation every tick | |
Returns a modified 100x100 pixel image to DragonRuby | |
*/ | |
#ifndef NULL |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# The text from the gist has been loaded. | |
# Click the Run game! button to execute the code. | |
# http://fiddle.dragonruby.org?share=https://gist.github.com/amirrajan/2f63f4d2fc97a81b087e6b4e6bd5bd92 | |
def tick args | |
xa = 100 + ((args.state.tick_count) % 300) | |
xb = 550 + ((args.state.tick_count/2) % 357) | |
xc = 440 + ((args.state.tick_count) % 413) | |
xd = 1000 - ((args.state.tick_count / 3) % 988) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
RAYS = 128 | |
SPLIT = 8 | |
RAYSPERPASS = 4 | |
CLEAR = 60 | |
DRAW_RAYS = true | |
MAX = 500 | |
ACCURACY = 2 # Accepts numbers 1 or 2. For some reason 3 or greater crashes? Lower is more accurate, but slower | |
DEGREES_TO_RADIANS = Math::PI / 180 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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 file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# self editor | |
$gtk.reset | |
$mapfile = '/app/main.rb' | |
$file_source = $gtk.read_file($mapfile).each_line.to_a | |
$reload_tick = 0 | |
def tick(args) | |
if args.state.tick_count == 0 | |
args.state.cursor.row = 0 | |
args.state.cursor.col = 0 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$gtk.reset | |
class Button | |
attr_accessor :label | |
def initialize(x, y, h, w, label) | |
@x = x | |
@y = y | |
@h = h | |
@w = w | |
@label = label |
All code is available in example app - https://github.com/maxivak/webpacker-rails-example-app
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'active_support/all' | |
require 'chinese_pinyin' | |
require 'csv' | |
CSV.open('name_t.csv', 'w') do |csv| | |
csv << %w[chinese_name last_name first_name] | |
file = File.new('/Users/guochunzhong/Downloads/name_list.txt') | |
file.each do |line| | |
values = [] | |
name = line.strip |