Skip to content

Instantly share code, notes, and snippets.

View Eric-Guo's full-sized avatar

Eric Guo Eric-Guo

View GitHub Profile
@Eric-Guo
Eric-Guo / ext.c
Created May 31, 2021 23:37 — forked from oeloeloel/ext.c
DragonRuby Pixel Arrays with C Extensions. Quick and Dirty example.
/*
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
@Eric-Guo
Eric-Guo / main.rb
Created May 30, 2021 08:50 — forked from sprite-guard/main.rb
Moving bezier curves with gaps
# 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)
@Eric-Guo
Eric-Guo / basicgorillas.rb
Created May 28, 2021 13:19 — forked from icculus/basicgorillas.rb
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
@Eric-Guo
Eric-Guo / main.rb
Last active May 23, 2021 00:47 — forked from jschoolcraft/main.rb
Coin Toss
$gtk.reset
class Button
attr_accessor :label
def initialize(x, y, h, w, label)
@x = x
@y = y
@h = h
@w = w
@label = label
@Eric-Guo
Eric-Guo / webpacker_rails.md
Created December 11, 2020 16:11 — forked from maxivak/webpacker_rails.md
Webpack, Yarn, Npm in Rails
@Eric-Guo
Eric-Guo / webpacker_rails.md
Created December 11, 2020 16:11 — forked from maxivak/webpacker_rails.md
Webpack, Yarn, Npm in Rails
@Eric-Guo
Eric-Guo / ruby_gems_age.rb
Created August 18, 2019 02:58 — forked from borama/ruby_gems_age.rb
A script that collects and prints info about the age of all ruby gems in your project, see https://dev.to/borama/how-old-are-dependencies-in-your-ruby-project-3jia
#!/bin/env ruby
#
# Collects info about the age of all gems in the project
#
require "json"
require "date"
bundle = `bundle list`
yearly_stats = {}
@Eric-Guo
Eric-Guo / rails-docker-build-speed-up.md
Created June 28, 2019 13:22 — forked from huacnlee/rails-docker-build-speed-up.md
给 Rails 应用 Docker Image 打包过程增加 cache,依靠 GitLab CI 的 cache 来加速

.yarnrc

我们需要在 Rails 项目根目录配置 .yarnrc 告诉 Yarn 我们需要将 npm 的包缓存到 vendor/cache/npm 目录。

registry "https://registry.npm.taobao.org"
lastUpdateCheck 1561690751463
yarn-offline-mirror "./vendor/cache/npm"     
yarn-offline-mirror-pruning true
@Eric-Guo
Eric-Guo / decode_session_cookie.rb
Created September 11, 2018 06:20 — forked from profh/decode_session_cookie.rb
A simple script to decode Rails 4 session cookies
@Eric-Guo
Eric-Guo / action_mailer-dont_log_attachments.rb
Last active October 19, 2017 04:27 — forked from TylerRick/action_mailer-dont_log_attachments.rb
Override the version from the actionmailer gem in order to not log attachments.
ActionMailer::Base.class_eval do
class << self
protected
# Override the version from the actionmailer gem in order to not log attachments.
#
def set_payload_for_mail(payload, mail) #:nodoc:
payload[:mailer] = name
payload[:message_id] = mail.message_id
payload[:subject] = mail.subject