This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# USAGE: `ruby ask_cpteeves.rb` | |
# Type "exit" to quit | |
require 'bundler/inline' | |
gemfile do | |
source 'https://rubygems.org' | |
gem 'ruby-openai' | |
gem 'pry' | |
gem 'tty-prompt' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
Ever wanted to delete all your likes/favorites from Twitter but only found broken/expensive tools? You are in the right place.
- Go to: https://twitter.com/{username}/likes
- Open the console and run the following JavaScript code:
setInterval(() => {
for (const d of document.querySelectorAll('div[data-testid="unlike"]')) {
d.click()
}
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# config/initializers/redis.rb | |
require 'redis' | |
# Disables the `flushdb` and `flushall` commands. | |
class Redis | |
module DangerousCommands | |
def flushdb | |
raise 'This is EXTREMELY DANGEROUS! If you really want to EMPTY THE ENTIRE DATABASE, do it from `redis-cli`.' | |
# You could call `super` here if you want to allow access in some circumstances. | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# I was using https://github.com/maclover7/trix to do: | |
# | |
# f.input :my_input, as: :trix_editor | |
# | |
# Its currently been over two weeks since Rails 5.2 was released, and the | |
# gem was the only thing preventing me from using it in multiple projects: | |
# https://github.com/maclover7/trix/pull/61#issuecomment-384312659 | |
# | |
# So I made this custom simpleform input for my apps to prevent this from happening again in the future. | |
# |
- Website: https://stimulusjs.org/
- GitHub repo: https://github.com/stimulusjs/stimulus
- Handbook: https://stimulusjs.org/handbook/introduction
- Discourse: https://discourse.stimulusjs.org/
initialize
: once, when the controller is first instantiatedconnect
: anytime the controller is connected to the DOM
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# lib/tasks/db.rake | |
namespace :db do | |
desc "Dumps the database to db/APP_NAME.dump" | |
task :dump => :environment do | |
cmd = nil | |
with_config do |app, host, db, user| | |
cmd = "pg_dump --host #{host} --username #{user} --verbose --clean --no-owner --no-acl --format=c #{db} > #{Rails.root}/db/#{app}.dump" | |
end | |
puts cmd |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"alert_email": "email address where you want automated warnings to go", | |
"backup_interval": "int value for db backups, configurable on dashboard", | |
"backup_window": "int value for db backups, configurable on dashboard", | |
"ruby_version": "Ruby 1.9.3 - could be 2.0.0 or something else", | |
"db_host": "internal hostname of your database master", | |
"db_slaves": [ | |
"db replica hosts appear here. only works with [Postgre|My]SQL" | |
], | |
"user_ssh_key": [ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env perl | |
# | |
# http://daringfireball.net/2007/03/javascript_bookmarklet_builder | |
use strict; | |
use warnings; | |
use URI::Escape qw(uri_escape_utf8); | |
use open IO => ":utf8", # UTF8 by default | |
":std"; # Apply to STDIN/STDOUT/STDERR |
NewerOlder