Skip to content

Instantly share code, notes, and snippets.

View stefanbohacek's full-sized avatar
💭
✊✊🏼✊🏽✊🏾

Stefan Bohacek stefanbohacek

💭
✊✊🏼✊🏽✊🏾
View GitHub Profile
@GreenFootballs
GreenFootballs / mastodon-embed.js
Last active June 13, 2023 18:37
Revised Mastodon embed script, handles dynamically added oembed iframes
/**
* Revised by Charles Johnson - https://github.com/GreenFootballs
*
* Runs automatically at window.onload(), searches document for iframes with a class of "mastodon-embed"
* and resizes them to fit the content, using window.postMessage() to get the content height from the
* embedded page.
*
* Adds an object named "_mastodonTools" to the window element, with an "embed" method.
*
* To resize dynamically added Mastodon iframes, call "_mastodonTools.embed(container, callback)"
@nolanlawson
nolanlawson / scaling_mastodon_down.md
Last active May 4, 2024 01:48
Scaling Mastodon down

Scaling Mastodon down

There is already a guide on scaling your Mastodon server up. This is a short guide on scaling your Mastodon server down.

I.e., maybe you want to run a small instance of <100 active users, and you want to keep your cloud costs reasonable. So you might be running everything on a single machine, with limited memory and CPU. (In my case, I was using a t3.medium instance with 2 vCPUs and 4GB of RAM.) How do you do this?

Note that I'm not a Ruby or Sidekiq expert, and most of this stuff I figured out through trial and error.

@tylermorganwall
tylermorganwall / submarine_cable_map.R
Last active April 19, 2024 07:36
Submarine Cable Map Dataviz
library(geojsonsf)
library(sf)
library(rayrender)
#Data source: https://github.com/telegeography/www.submarinecablemap.com
cables = geojson_sf("cable-geo.json")
cablescene = list()
counter = 1
for(i in 1:length(cables$geometry)) {
@jeffThompson
jeffThompson / Apollo11GuidanceComputerVertAndNounList.txt
Created February 15, 2016 16:32
A list of "nouns" and "verbs" to control the Apollo 11 guidance computer.
APOLLO 11 GUIDANCE COMPUTER: VERB AND NOUN LIST
https://en.wikipedia.org/wiki/Apollo_Guidance_Computer#/media/File:Agc_verb-noun-list.jpg
VERB LIST
50 PLEASE PERFORM
51 PLEASE MARK
53 PLEASE MARK ALT LOG
54 REND COAS MARK
56 TERMINATE P20
58 STICKFLAG (R) V50N18 FLAG(S)
@airhadoken
airhadoken / twittercard.js
Last active February 4, 2022 18:41
Making twitter cards and also getting data back from them later, in NodeJS.
var T = require("twit");
var Q = require("q");
// key and secret for Twitter for iPhone.
// A whitelisted app is needed to access the cards API; you can't just create your own currently.
var TWITTER_CONSUMER_KEY = "IQKbtAYlXLripLGPWd0HUA";
var TWITTER_CONSUMER_SECRET = "GgDYlkSvaPxGxC4X8liwpUoqKwwr3lCADbz8A7ADU";
// These you will have to fill in yourself by authorizing Twitter for iPhone for your account.
// How to get the access tokens through OOB authorization is outside the scope of this snippet.
var TWITTER_ACCESS_TOKEN = "";
@paulirish
paulirish / what-forces-layout.md
Last active April 30, 2024 17:56
What forces layout/reflow. The comprehensive list.

What forces layout / reflow

All of the below properties or methods, when requested/called in JavaScript, will trigger the browser to synchronously calculate the style and layout*. This is also called reflow or layout thrashing, and is common performance bottleneck.

Generally, all APIs that synchronously provide layout metrics will trigger forced reflow / layout. Read on for additional cases and details.

Element APIs

Getting box metrics
  • elem.offsetLeft, elem.offsetTop, elem.offsetWidth, elem.offsetHeight, elem.offsetParent
@anandkumar
anandkumar / functions.php
Created October 8, 2014 17:54
bbPress: Remove stupid 14px avatar and resize other.
<?php
//* Do NOT include the opening php tag
//* Notice the line 7, 8, 10 and 11
function my_bbp_change_avatar_size($author_avatar, $topic_id, $size) {
$author_avatar = '';
if ($size == 14) {
return $author_avatar;
}
@yanofsky
yanofsky / LICENSE
Last active May 4, 2024 08:45
A script to download all of a user's tweets into a csv
This is free and unencumbered software released into the public domain.
Anyone is free to copy, modify, publish, use, compile, sell, or
distribute this software, either in source code form or as a compiled
binary, for any purpose, commercial or non-commercial, and by any
means.
In jurisdictions that recognize copyright laws, the author or authors
of this software dedicate any and all copyright interest in the
software to the public domain. We make this dedication for the benefit
@jlong
jlong / uri.js
Created April 20, 2012 13:29
URI Parsing with Javascript
var parser = document.createElement('a');
parser.href = "http://example.com:3000/pathname/?search=test#hash";
parser.protocol; // => "http:"
parser.hostname; // => "example.com"
parser.port; // => "3000"
parser.pathname; // => "/pathname/"
parser.search; // => "?search=test"
parser.hash; // => "#hash"
parser.host; // => "example.com:3000"
@connor
connor / .jshintrc.js
Created January 11, 2012 22:20
jshintrc example
// NOTE: I added the .js extension to this gist so it would have syntax highlighting. This file should have NO file extension
{
// Settings
"passfail" : false, // Stop on first error.
"maxerr" : 100, // Maximum error before stopping.
// Predefined globals whom JSHint will ignore.
"browser" : true, // Standard browser globals e.g. `window`, `document`.