Skip to content

Instantly share code, notes, and snippets.

View brettchalupa's full-sized avatar

Brett Chalupa brettchalupa

View GitHub Profile
@brettchalupa
brettchalupa / main.gd
Created April 3, 2023 13:00
Godot Player Input Sample
extends Node2D
var rotate_icon = true
var speed = 10
func _process(delta: float) -> void:
if rotate_icon:
$Icon.rotate(delta)
if Input.is_action_pressed("move_down"):
@brettchalupa
brettchalupa / README.md
Last active February 19, 2023 01:18
SDL2 Windows Rumble Tester

Windows variant of https://github.com/brettchalupa/sdl_rumble since that didn't work as expected on Windows like it does on macOS and Linux.

Notes to self:

  • Used Code::Blocks with mingw 64 bit
  • SDL 2.26.3
  • PS4 hint allows for DualShock 4 rumble without any special drivers

Learnings:

@brettchalupa
brettchalupa / menu_demo.rb
Last active December 23, 2022 20:48
DragonRuby Game Toolkit Menu Demo
# LICENSE: https://unlicense.org/ a.k.a. do whatever you want with it, no credit or notice needed
def tick(args)
args.state.scene ||= :main_menu
args.state.main_menu.options ||= [
{
text: "Start",
on_select: -> (args) { args.state.scene = :gameplay }
},
{
text: "Settings",
@brettchalupa
brettchalupa / main.rb
Last active November 22, 2022 01:51
DragonRuby GTK PadBud Source r1
PADDING = 20
def tick args
args.outputs.background_color = [255, 255, 255]
args.outputs.labels << [PADDING, args.grid.h - PADDING, 'PadBud', 3]
args.outputs.labels << [PADDING, args.grid.h - PADDING * 3, 'A simple tool for viewing DragonRuby gamepad input.']
args.outputs.labels << [PADDING, 140, 'Platform Details', 2]
args.outputs.labels << [PADDING, 110, "OS: #{args.gtk.platform}"]
args.outputs.sprites << { x: PADDING + 80, y: args.grid.h - PADDING - 28, h: 32, w: 32, path: "metadata/icon.png" }
@brettchalupa
brettchalupa / asset-cleanup.rb
Created February 11, 2022 23:03
Wordpress image export filename clean up
# A simple script for cleaning up Wordpress file exports that have URL params potentially appended to the end, e.g. `foo.jpg?w=720`
# Assumes the files are located in the `assets` dir
require "fileutils"
def clean_up_files(dir)
Dir.foreach(dir) do |f|
next if f == "." || f == ".."
path = dir + "/" + f
puts path
@brettchalupa
brettchalupa / _organize_mp3s.rb
Last active February 4, 2022 18:40
Organize MP3s Ruby Script
# Organize MP3s by Brett Chalupa
#
# Pre-reqs:
# 1. Ruby v2+
# 2. gem install id3tag
#
# This script loops through a directory of mp3 files, like a an archive
# download from YouTube Music, and organizes them into the following structure
# in the folder:
#
@brettchalupa
brettchalupa / config.yml
Created September 15, 2016 23:33
Shopify Theme Kit config example for screencast (https://www.youtube.com/watch?v=1xWFsYmBoX0)
development:
store: example.myshopify.com
password: add-password-in-config
theme_id: "live"
bucket_size: 40
refill_rate: 2
ignore_files:
- "*.swp"
- "*~"
- "config/settings_data.json"
@brettchalupa
brettchalupa / http_write.rb
Created October 11, 2012 22:00
Write an HTTParty GET request to a file.
File.open( "/tmp/my_movie.mov", "w") do |movie|
movie << HTTParty.get( "http://example.com/movie.mov" )
end
@brettchalupa
brettchalupa / Rakefile
Created March 14, 2016 19:03
Testing Rake tasks with RSpec examples from the talk I gave at Test Ruby PDX in March 2016. See more here: http://bit.ly/testing-rake-tasks
require_relative 'greeter'
desc 'Outputs a greeting to stdout'
task :hello do
Greeter.new.greet
end
@brettchalupa
brettchalupa / independent_contractor_agreement.md
Last active April 3, 2018 20:49 — forked from malarkey/Contract Killer 3.md
Independent contractor agreement based off of the Contract Killer 3.

Independent Contractor Agreement

Between us [company name] and you [customer name]

Summary:

We’ll always do our best to fulfill your needs and meet your expectations, but it’s important to have things written down so that we both know what’s what, who should do what and when, and what will happen if something goes wrong. In this contract you won’t find any complicated legal terms or long passages of unreadable text. We’ve no desire to trick you into signing something that you might later regret. What we do want is what’s best for both parties, now and in the future.

So in short;