Skip to content

Instantly share code, notes, and snippets.

View danielpuglisi's full-sized avatar
💭
🤘

Daniel Puglisi danielpuglisi

💭
🤘
View GitHub Profile
@rahularity
rahularity / work-with-multiple-github-accounts.md
Last active April 25, 2024 02:55
How To Work With Multiple Github Accounts on your PC

How To Work With Multiple Github Accounts on a single Machine

Let suppose I have two github accounts, https://github.com/rahul-office and https://github.com/rahul-personal. Now i want to setup my mac to easily talk to both the github accounts.

NOTE: This logic can be extended to more than two accounts also. :)

The setup can be done in 5 easy steps:

Steps:

  • Step 1 : Create SSH keys for all accounts
  • Step 2 : Add SSH keys to SSH Agent
@dhh
dhh / Gemfile
Created June 24, 2020 22:23
HEY's 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
sojastar / keymap.rb
Created May 26, 2020 07:52
Key mapping swap for DragonRuby
module KeyMap
def self.set(mapping)
mapping.each_pair do |command,key|
GTK::KeyboardKeys.send :alias_method, command, key
end
end
def self.unset(mapping)
mapping.each_pair do |command,key|
GTK::KeyboardKeys.send :undef_method, command
@dbridges
dbridges / _comment.html.slim
Last active August 25, 2022 18:51
Stimulus.js and Rails remote forms with error handling
- # app/views/comments/_comment.html.slim
li data-controller="comment" data-action="click->comment#hello"
= "#{comment.message} by #{comment.user.email}"
@mrmartineau
mrmartineau / stimulus.md
Last active April 19, 2024 09:41
Stimulus cheatsheet
@giannisp
giannisp / gist:ebaca117ac9e44231421f04e7796d5ca
Last active March 1, 2024 14:39
Upgrade PostgreSQL 9.6.5 to 10.0 using Homebrew (macOS)
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
begin
require "bundler/inline"
rescue LoadError => e
$stderr.puts "Bundler version 1.10 or later is required. Please update your Bundler"
raise e
end
gemfile(true) do
source "https://rubygems.org"
@landovsky
landovsky / add_signature_fields_to_delayed_jobs.rb
Last active November 21, 2023 08:47 — forked from synth/add_signature_fields_to_delayed_jobs.rb
Prevent Duplicates with Delayed Jobs
class AddFieldsToDelayedJobs < ActiveRecord::Migration
def change
add_column :delayed_jobs, :signature, :string, index: true
add_column :delayed_jobs, :args, :text
end
end

Smalltalk Best Practice Patterns in Ruby

1 – INTRODUCTION

  • 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
bufordtaylor / icloud-caldav.rb
Created October 27, 2016 16:51 — forked from ericboehs/icloud-caldav.rb
Interface with Apple's iCloud CalDav Calendars
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