View websocket_backend.rb
# This file's job is to accept WebSocket connections
# and pass along Redis messages to them
require 'faye/websocket'
class WebSocketBackend
def initialize(app)
@app = app
@clients = []
@running = false
View twitter-rate-limit.rb
# I wanted to get rate limit info from Twitter without there being an error condition
# I can't find a nice way to do this with the Ruby twitter gem, other than this..
rate_limits = Twitter::REST::Request.new(client, :get, '/1.1/application/rate_limit_status.json').perform
View 01-activerecord.rb
require "active_record"
ActiveRecord::Base.establish_connection('postgres:///testing')
ActiveRecord::Migration.verbose = false
ActiveRecord::Migration.class_eval do
create_table :played_quizzes, force: true do |t|
t.integer :player_ids, array: true
t.json :quiz_snapshot
end
View sysv-msg-queue.rb
# A scrappy example library to access the System V message queue
# functionality in macOS. Works on macOS Sierra with Ruby 2.4.
#
# For more info on sysv message queues:
# https://www.softprayog.in/programming/interprocess-communication-using-system-v-message-queues-in-linux
require 'fiddle'
class MsgQ
LIBC = Fiddle.dlopen('libc.dylib')
View igliker.rb
# igliker.rb - An Instagram mass list liker by pet'rc
# ---------------------------------------------------
#
# Takes a list of accounts and likes the latest post
# on each by remote controlling a Firefox instance.
#
# This is quite technical to use and requires you have Ruby
# installed (such as on macOS), as well as Firefox, and
# be happy using the terminal.
#
View vinescrape.rb
# vinescrape.rb goes through an account's Vines and downloads them, skipping revines
# I had to write it because I didn't get notified of the download deadline and
# with no email address on their site, it wouldn't let me get my archive..
# so I came up with this approach instead :-D
#
# To use, just change the VINE_USER_ID string below to the long set of digits that makes up YOUR Vine ID
# Then ruby vinescrape.rb
# Works fine with no dependencies on Ruby 2.4 on OS X, should work fine elsewhere too
VINE_USER_ID = "970482265149054976"
View inboxcheck.rb
# inboxcheck.rb monitors a Gmail account for new mails and returns
# info (as JSON) about the first new mail from a specified address
#
# This is used to see if our newsletter testing mails arrive at
# Gmail and then if they go into spam, promotions or the normal inbox.
#
# To use or work on this script for yourself, follow steps 1 and 2 at
# https://developers.google.com/gmail/api/quickstart/ruby to get set
# up with the Google API stuff. Make sure client_secret.json ends up
# in the same directory as this script, then you're good to go.
View grabscreen.m
//
// main.m
// grabscreen
//
// Created by Peter Cooper on 09/10/2016.
// Copyright © 2016 Peter Cooper. All rights reserved.
//
#import <Cocoa/Cocoa.h>
#include <ApplicationServices/ApplicationServices.h>
View jetman.rb
# Decoding and encoding of Solar Jetman (NES)
# game password codes
#
# Based on research done by Bisqwit / Joel Yliluoma
# See https://www.youtube.com/watch?v=Ex1iFZuUdJ4
SYMBOLS = %w{B D G H K L M N P Q R T V W X Z}
def checksum_for_bytes(bytes)
((((bytes[0] ^ bytes[1]) + bytes[2]) ^ bytes[4]) * 257 / 256 + bytes[5]) & 0b11111111
View apology.md

Readers,

Everyone makes mistakes and the best that can come out of one is a sinvecere apology and a determination to learn a lesson and improve for the future.

In last week's Ruby Weekly, we mistakenly included some material that unkindly referenced Reddit's ex-CEO Ellen Pao (it rhetorically asked if your app deployments were as 'horrible'). Pao has suffered a lot of negative press and abuse online recently and this reference was irrelevant, unnecessary and in poor taste. Contributing to a negative bandwagon does not fit with what readers expect of our newsletter.

I personally apologize to our readers and Ellen Pao for not meeting our usual standards. I also want to thank the readers who reached out to me about this matter for keeping us in check.

While the material was sponsor supplied and not written by us, we are responsible to our readers for their experience. Nonetheless, the advertiser has made their own statement here. I lacked the full context for