Skip to content

Instantly share code, notes, and snippets.

Working from home

Daniel Puglisi danielpuglisi

Working from home
View GitHub Profile
dhh / Gemfile
Created Jun 24, 2020
HEY's Gemfile
View Gemfile
ruby '2.7.1'
gem 'rails', github: 'rails/rails'
gem 'tzinfo-data', '>= 1.2016.7' # Don't rely on OSX/Linux timezone data
# Action Text
gem 'actiontext', github: 'basecamp/actiontext', ref: 'okra'
gem 'okra', github: 'basecamp/okra'
# Drivers
sojastar / keymap.rb
Created May 26, 2020
Key mapping swap for DragonRuby
View keymap.rb
module KeyMap
def self.set(mapping)
mapping.each_pair do |command,key|
GTK::KeyboardKeys.send :alias_method, command, key
def self.unset(mapping)
mapping.each_pair do |command,key|
GTK::KeyboardKeys.send :undef_method, command
dbridges / _comment.html.slim
Last active Oct 12, 2021
Stimulus.js and Rails remote forms with error handling
View _comment.html.slim
- # app/views/comments/_comment.html.slim
li data-controller="comment" data-action="click->comment#hello"
= "#{comment.message} by #{}"
mrmartineau /
Last active Jan 26, 2022
Stimulus cheatsheet
giannisp / gist:ebaca117ac9e44231421f04e7796d5ca
Last active Mar 19, 2021
Upgrade PostgreSQL 9.6.5 to 10.0 using Homebrew (macOS)
View gist:ebaca117ac9e44231421f04e7796d5ca
After automatically updating Postgres to 10.0 via Homebrew, the pg_ctl start command didn't work.
The error was "The data directory was initialized by PostgreSQL version 9.6, which is not compatible with this version 10.0."
Database files have to be updated before starting the server, here are the steps that had to be followed:
# need to have both 9.6.x and latest 10.0 installed, and keep 10.0 as default
brew unlink postgresql
brew install postgresql@9.6
brew unlink postgresql@9.6
brew link postgresql
View rails_single_file.rb
require "bundler/inline"
rescue LoadError => e
$stderr.puts "Bundler version 1.10 or later is required. Please update your Bundler"
raise e
gemfile(true) do
source ""
View add_signature_fields_to_delayed_jobs.rb
class AddFieldsToDelayedJobs < ActiveRecord::Migration
def change
add_column :delayed_jobs, :signature, :string, index: true
add_column :delayed_jobs, :args, :text
View BN 201702020805 Smalltalk Best Practice

Smalltalk Best Practice Patterns in Ruby


  • We aren’t always good at guessing where responsibilities should go. Coding is where our design guesses are tested. Being prepared to be flexible about making design changes during coding results in programs that get better and better over time.

  • If you’re programming along, doing nicely, and all of a sudden your program gets balky, makes things hard for you, it’s talking. It’s telling you there is something important missing.

  • Some of the biggest improvements come from figuring out how to eliminate:

    • Duplicate code (even little bits of it)
bufordtaylor / icloud-caldav.rb
Created Oct 27, 2016 — forked from ericboehs/icloud-caldav.rb
Interface with Apple's iCloud CalDav Calendars
View icloud-caldav.rb
require 'rexml/document'
require 'rexml/xpath'
require 'http'
require 'icalendar'
HTTP::Request::METHODS = HTTP::Request::METHODS + [:report]
module AppleCalDav
class Client
attr_accessor :username, :password
chrisbodhi / copy.rb
Created Sep 21, 2016
Copy from IRB/Pry to the system clipboard
View copy.rb
def pbcopy(input)
str = input.to_s
IO.popen('pbcopy', 'w') { |f| f << str }