Skip to content

Instantly share code, notes, and snippets.

View thedayisntgray's full-sized avatar

Landon Gray thedayisntgray

View GitHub Profile
# config/initializers/phlex_template_handler.rb
require "action_view"
require "phlex"
# Intercept unknown "capitalized" method calls (e.g., PageView(...)) in templates,
# look up a Phlex component class, instantiate it, and render it.
# Crucially, we re-bind the user’s block so that `self` is the component, not the ActionView context.
module PhlexDynamicMethodCalls
def method_missing(name, *args, **kwargs, &block)
# Only intercept method calls starting with an uppercase letter (e.g. "PageView", "MyComponent", etc.)
@davidhershey
davidhershey / draft_prompt.txt
Created December 4, 2023 22:25
Magic Draft Prompt
In our Magic the Gathering draft, we're on pack 3 pick 1. These are the contents of our pool so far:
-------------------------
Evolving Wilds -- (common)
Brave the Wilds -- {G} (common)
Vampiric Rites -- {B} (uncommon)
Torch the Tower -- {R} (common)
Hopeless Nightmare -- {B} (common)
Harried Spearguard -- {R} (common)
Leaping Ambush -- {G} (common)
Questing Druid // Seek the Beast -- {1}{G} // {1}{R} (rare)
@eddroid
eddroid / rapid.md
Last active October 1, 2023 01:57
Rapid Prototyping with Rails

Rapid Prototyping with Rails

At Wyncode we turn people into full-stack web developers in 10 weeks. So we've learned a few tricks to get from 0 to webapp quickly.

Install Ruby and Rails

Generate the app skeleton

@Ravenstine
Ravenstine / how_to_host_a_rails_app_on_a_home_server.md
Last active January 15, 2025 16:09
How to Host a Rails App on a Home Server

Host to Host a Rails App on a Home Server

Hosting services like Heroku and Amazon EC2 are nice. That is, until they cost money. Some things are worth running on your own hardware, especially when the cost and Terms of Service requirements outweigh the expense of rolling your own hosting.

I am writing this because I recently had to figure all this out in order to host a personal blog off a Raspberry Pi, and I thought I'd share what I learned. This guide assumes that you already know how to install Ruby and you know how to use Rails. If you don't, look those up first before coming back to this guide.

Prerequisites

  • Ruby >=2.0
  • Rails >=4.0
  • Nginx
@jbonney
jbonney / spotify_keybindings
Created June 9, 2013 13:22
Spotify - Linux key bindings. From XFCE / Ubuntu keyboard shortcuts configuration, assign the control command to their key. http://shkspr.mobi/blog/2011/12/linux-spotify-keybindings/
"dbus-send --print-reply --dest=org.mpris.MediaPlayer2.spotify /org/mpris/MediaPlayer2 org.mpris.MediaPlayer2.Player.PlayPause" XF86AudioPlay
"dbus-send --print-reply --dest=org.mpris.MediaPlayer2.spotify /org/mpris/MediaPlayer2 org.mpris.MediaPlayer2.Player.Stop" XF86AudioStop
"dbus-send --print-reply --dest=org.mpris.MediaPlayer2.spotify /org/mpris/MediaPlayer2 org.mpris.MediaPlayer2.Player.Next" XF86AudioNext
"dbus-send --print-reply --dest=org.mpris.MediaPlayer2.spotify /org/mpris/MediaPlayer2 org.mpris.MediaPlayer2.Player.Previous" XF86AudioPrevious
@hubgit
hubgit / list-files-in-folder.js
Created September 20, 2012 11:20
List all files in a folder (Google Apps Script)
function listFilesInFolder() {
var folder = DocsList.getFolder("Maudesley Debates");
var contents = folder.getFiles();
var file;
var data;
var sheet = SpreadsheetApp.getActiveSheet();
sheet.clear();

tmux cheatsheet

As configured in my dotfiles.

start new:

tmux

start new with session name:

@nathansmith
nathansmith / web-design-development-learning-resources.md
Last active October 12, 2024 17:08
Resources for learning web design & front-end development