Skip to content

Instantly share code, notes, and snippets.

View lazyatom's full-sized avatar
🤠
Yes

James Adam lazyatom

🤠
Yes
View GitHub Profile
@lazyatom
lazyatom / ruby-social-database-size.md
Last active September 3, 2024 11:39
Cleaning up Ruby.social

Hey folks.

Firstly, thanks for being here.

Secondly, while you read this, I want to be totally clear that I am not asking you for money, just your thoughts.

Ruby.social has been running for 6 years, and for that whole time we've been hosted by Hugo at https://masto.host. This was one of the best decisions I made in the early life of the instance; we've had almost no issues at all, and any time we've needed help, Hugo has been right there.

All that great service doesn't come for free though (nor should it!); right now the instance hosting costs about $300/month. Even though their numbers are gradually decreasing, our existing patrons and sponsors easily cover this (thank you!) so there's no financial cliff looming.

Fedifeed implementation notes
Two components
Server implements a few endpoints
/reblogs — returns accounts that you reblog the most
/core_servers — returns the instances who host most of the accounts you follow
/favourites — returns users that you favourite the most
Client hits those endpoints, and then:
@lazyatom
lazyatom / Output
Last active October 3, 2016 12:36
Huffman encoding and decoding
$ ruby huffman.rb this is a test of compression
input length in bits 232 (29 * 8)
Binary 1111100000100011001000110100101101111101000111111001111100110111010111001110001101111010000001001110110
Encoded string length in bits: 103
Compression: 44.396551724137936%
Decoded: this is a test of compression
@lazyatom
lazyatom / jruby_refinements.rb
Created December 18, 2015 14:40
Do refinements work in JRuby?
module Refinement
refine Object do
def new_method
'new method!'
end
end
end
class Thing
using Refinement
@lazyatom
lazyatom / app1.rb
Created February 6, 2015 15:05
Detecting where your library has been required from
# Some userland app code
$LOAD_PATH.unshift "."
require 'lib'

this is a test

  • item one
  • item two
  • item three

test complete! but what about normal lists?

  • thing
  • another thing

Keybase proof

I hereby claim:

  • I am lazyatom on github.
  • I am lazyatom (https://keybase.io/lazyatom) on keybase.
  • I have a public key whose fingerprint is BE7C E844 BBAA 3308 53A6 63B5 13FD BF1B D9DA 2B35

To claim this, I am signing this object:

@lazyatom
lazyatom / playing-with-docker-instructions.md
Last active August 29, 2015 13:56
Austin on Rails - play around with Docker

If you'd like a taste of Docker, here's how to get my silly Taco app running under Docker on your machine.

First, install docker-osx

... using instructions from https://github.com/noplay/docker-osx

curl https://raw.github.com/noplay/docker-osx/0.8.0/docker-osx > /usr/local/bin/docker-osx
chmod +x /usr/local/bin/docker-osx

Then start the docker VM

How Should We Use Struct?

The Choice

It's common in Ruby to see some code setup a Struct like this:

class Specialized < Struct.new(:whatever)
  # ... define custom methods here...
end
@lazyatom
lazyatom / rocco.css
Created April 2, 2013 09:29
Rocco CSS
/*--------------------- Layout and Typography ----------------------------*/
body {
font-family: 'Palatino Linotype', 'Book Antiqua', Palatino, FreeSerif, serif;
font-size: 15px;
line-height: 22px;
color: #252519;
margin: 0; padding: 0;
}
a {
color: #261a3b;