Skip to content

Instantly share code, notes, and snippets.

View macabreb0b's full-sized avatar

a knee macabreb0b

View GitHub Profile
@macabreb0b
macabreb0b / meetupMassUnsubscribe
Last active October 24, 2022 21:18
Unsubscribe from all group notifications on Meetup.com
// Tired of getting Meetup.com notifications? Me too.
// 1. Navigate to: http://www.meetup.com/account/comm/ (you must be logged in!)
// 2. Open your browser's console, and paste in the script below:
$('.commSettings').each(function(idx, item) {var $item = $(item);var boardId = $item.attr("id").split('_')[1];var url = $item.children('form').attr('action');var params = {evRemind:1,mailing_list_status:0, submitButton:'Save Settings', submit:'submit'};params['board_' + boardId] = boardId;$.ajax({data: params, url: url, type: 'post'});});$('.generalEmailSettings').find('input[type="checkbox"]').prop('checked', false);$('.generalEmailSettings').find('input[type="submit"]').click();
@macabreb0b
macabreb0b / pokemonDownloader.js
Last active November 23, 2017 20:05
Download pngs of the first 151 Pokemon from pokemon.com
// 1. Go to pokemon.com/us/pokedex
// 2. Copy + paste script into the console to reveal n pokemon and download their png source files.
// * change 151 to whatever number you like to download more / less pokemon.
var figures,
n = 151,
currentLength = 0;
loadMore.click();
var downloadImages = function() {
@macabreb0b
macabreb0b / dragon_boat.html
Last active August 29, 2015 14:08
render dragon boat seating chart with absolute positioning and hover effect
<html>
<head>
<style>
body * {
box-sizing: border-box;
}
.boat {
background-image: url(http://www.lively-dragon.com/Resources/Pictures/boat_seating.png);
background-size: 100% auto;
@macabreb0b
macabreb0b / jQuery.showCenter.js
Last active August 29, 2015 14:08
Click anywhere on your page to show crosshairs that reveal the vertical + horizontal midpoint.
$(function() {
$('body').one('click', function(event) {
var halfHeight = window.innerHeight / 2;
var halfWidth = window.innerWidth / 2;
var horizontalRule = $('<div style="width: 100%; height: ' + halfHeight + 'px; border: 0; border-bottom: thin solid blue; position: absolute; top:0;left:0"></div>');
var verticalRule = $('<div style="width: ' + halfWidth + 'px; height: 100%; border: 0; border-right: thin solid blue; position: absolute; top:0;left:0"></div>');
$('body').append(horizontalRule);
$('body').append(verticalRule);
})
@macabreb0b
macabreb0b / hashify_query_string.rb
Last active August 29, 2015 14:08
Rails-style Ruby method for turning a URL query string into a deeply-nested hash
require 'uri'
q1 = 'username=charlie&email=charlie@gmail'
q2 = 'user[username]=charlie&user[email]=charlie@gmail.com&user[password]=password'
q3 = 'user[address][street]=market&user[address][zipcode]=94103&user[email]=charlie@gmail.com'
puts URI.decode_www_form(q1).to_s
puts URI.decode_www_form(q2).to_s
puts URI.decode_www_form(q3).to_s
@macabreb0b
macabreb0b / linkedin_flirter.rb
Created October 31, 2014 00:21
A script for 'flirting' with users on LinkedIn by viewing their profiles
require 'selenium-webdriver'
username = 'your_username'
pword = 'your_pword'
browser = Selenium::WebDriver.for :firefox
browser.get 'https://linkedin.com'
wait = Selenium::WebDriver::Wait.new(:timeout => 10)
class Enumerable
def deep_dup
self.map do |*elements|
if element.is_a?(Enumerable)
element.deep_dup
else
elements.map do |element|
begin
duplicate = element.class.allocate
duplicate.send(:initialize_copy, element)
def subsets(array)
return [[]] if array.empty?
first = array.shift
subs = subsets(array)
other_subs = subs.map do |sub|
sub = sub + [first]
end
other_subs + subs
# for all numbers between 1 and a number,
# which can you add to the number infinitely
# (wrapping around when you hit the number)
# such that every number is stopped at once
def check_intervals(num)
best_intervals = []
current_max = 0
@macabreb0b
macabreb0b / .vimrc
Created December 10, 2014 18:01
dotfiles
set nocompatible " be iMproved, required
filetype off " required
" set the runtime path to include Vundle and initialize
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
" alternatively, pass a path where Vundle should install plugins
"call vundle#begin('~/some/path/here')
" let Vundle manage Vundle, required