Skip to content

Instantly share code, notes, and snippets.

View raderj89's full-sized avatar

Jared Rader raderj89

View GitHub Profile
class User < ApplicationRecord
has_many :posts
has_many :comments
# id :integer not null, primary key
# name :string(50) default("")
end
@raderj89
raderj89 / delete_comments_likes.js
Created March 25, 2018 17:21 — forked from DanTup/delete_comments_likes.js
Delete all Facebook posts for a year
// Only tested in Chrome...
// Must browse to "Your Comments" (or "Your Likes") page of activity feed, then pre-load the year you want to delete
// and as many comments as possible (scroll down, they load lazily).
//
// I ACCEPT ABSOLUTELY NO RESPONSIBILITY FOR THIS DOING BAD STUFF. THE NEXT FACEBOOK DEPLOYMENT
// COULD WELL BREAK THIS, OR MAKE IT DO THINGS YOU DO NOT EXPECT. USE IT AS A STARTING POINT ONLY!
//
// It will start failing once it gets to the end, just reload the page and kick it off again.
var rows = document.querySelectorAll('#year_2012 .pam._5shk');
@raderj89
raderj89 / add_user_id_to_sessions_devise.md
Last active May 13, 2020 07:46
Make sessions queryable by user with ActiveRecord Session Store and Devise

Make sessions queryable by user with ActiveRecord Session Store and Devise

  1. Install the ActiveRecord Session Store gem and read the documentation for how to use it and create your sessions table.

  2. Create a migration to add user_id to the sessions table.

class AddUserIdToSessions < ActiveRecord::Migration
  disable_ddl_transaction!