This is the companion to my YouTube video: https://youtu.be/MJSZ3WcgHeE
https://guides.rubyonrails.org/debugging_rails_applications.html
- Putting debug info into views using
debug
helper (orto_yaml
orinspect
)
# demo gameplay here: https://youtu.be/wQknjYk_-dE | |
# this is the core game class. the game is pretty small so this is the only class that was created | |
class Game | |
# attr_gtk is a ruby class macro (mixin) that adds the .args, .inputs, .outputs, and .state properties to a class | |
attr_gtk | |
# this is the main tick method that will be called every frame the tick method is your standard game loop. | |
# ie initialize game state, process input, perform simulation calculations, then render | |
def tick | |
defaults |
This is the companion to my YouTube video: https://youtu.be/MJSZ3WcgHeE
https://guides.rubyonrails.org/debugging_rails_applications.html
debug
helper (or to_yaml
or inspect
)FROM ruby:3.0-alpine | |
RUN apk add --no-cache --update \ | |
ack \ | |
bash \ | |
build-base \ | |
curl \ | |
git \ | |
htop \ | |
less \ |
# docker-compose.yml
version: '3'
services:
web:
build: ./
command: 'rails server -b 0.0.0.0 -p 3000'
ports:
- 4000:3000
#!/bin/env python3 | |
# https://www.bleepingcomputer.com/news/security/researcher-hacks-over-35-tech-firms-in-novel-supply-chain-attack/ | |
# The following script finds all package.json files in the current dir and checks if there are referenced any | |
# dependencies that no public package is available for, making your application vulnerable to supply-chain attack. | |
# Simply run ./packagejson.py in your root repository direcotory. | |
import json | |
import requests | |
from pathlib import Path | |
import urllib.parse |
#!/usr/bin/env ruby | |
# | |
# qn stands for 'Quick Note.' This app quickly creates a text file | |
# in a hardcoded or specified directory with a default filename. | |
# | |
# The filename is {project}_YYYY-MM-DD.txt | |
# | |
# One file per day, per project is created. If the file exist, the | |
# new note is appended. |
import { Controller } from "stimulus" | |
import $ from "jquery" | |
export default class extends Controller { | |
static targets = ["filter", "table", "pagination", "row"] | |
connect() { | |
this.page = Number(this.data.get("page")) || 1; | |
this.perPage = Number(this.data.get("per-page")) || 20; |
<div class="form-group"> | |
<%= form.label :type, "Type", class: "font-weight-bold" %> | |
<%= form.select :type, ['TextQuestion', 'UrlQuestion'], { include_blank: true }, { class: "form-control", data: { action: "input->toggle#changed", target: "toggle.select" } } %> | |
</div> | |
<div class="form-group"> | |
<%= form.label :name, "Name", class: "font-weight-bold" %> | |
<%= form.text_field :name, class: "form-control" %> | |
</div> | |
<div class="form-group" data-target="toggle.element" data-values="UrlQuestion"> | |
<%= form.label :url, "URL", class: "font-weight-bold" %> |
As a Ruby on Rails developer, I'm always looking for the best tools and practices to apply to my day-to-day development. This framework has a fantastic structure where all its inner parts communicate very well. But, as applications start growing, or developers want to start using more modern technologies, several things start getting out of control.
Recent versions of Rails implemented Webpack, facilitating the use of modern JavaScript frameworks, which added another level of robustness to everyone's applications. Not only is this becoming the new standard, but it also enables bigger code-bases without falling into madness.
Facebook, as the creator of ReactJS (one of these modern JS frameworks and the most popular one) introduced to the world another of its technologies, GraphQL. This tool, like any other tool, can be a great asset, as long as it's in the right hands, meaning that you first need to know what role it plays before exploring how to use it in your RoR appli
This controller can be put on body or any other element.
connected
boolean getterdata-action-cable-connected
or data-action-cable-disconnected
attributes which can be used for CSS selectorsaction-cable:connected
or action-cable:disconnected
events only when state is flippingI intend to document the navigator.onLine
accessor and the window:online/offline
events so devs can handle PWA modes.