Skip to content

Instantly share code, notes, and snippets.

fixin' bugs and givin' hugs

Tom Scott tubbo

fixin' bugs and givin' hugs
Block or report user

Report or block tubbo

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
tubbo / Dockerfile
Last active Nov 26, 2018
docker compose setup for soundstorm
View Dockerfile
# Docker image build script for Soundstorm
# Use latest Ruby
FROM ruby:2.5.3
# Install system dependencies
RUN curl -sL | bash - \
&& curl -sS | apt-key add - \
tubbo / gist:1368091
Created Nov 15, 2011
Diaspora Conversations Controller
View gist:1368091
class ConversationsController < ApplicationController
before_filter :authenticate_user!
respond_to :html, :json, :js
def index
page = params[:page]
id = params[:conversation_id]
@conversations = current_user.visible_conversations page
@visibilities = current_user.visibilities page
tubbo / polymorphic.rb
Last active Apr 13, 2017 — forked from laspluviosillas/polymorphic.rb
Issue with polymorphic associations
View polymorphic.rb
class Task < ActiveRecord::Base
has_one :notification_preference, as: :notifee
accepts_nested_attributes_for :notification_preference
class NotificationPreference < ActiveRecord::Base
belongs_to :notifee, polymorphic: true
View snippet.txt
root@tom_itt:/home/tom/src/speex# ./configure
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for a thread-safe mkdir -p... /bin/mkdir -p
checking for gawk... no
checking for mawk... mawk
checking whether make sets $(MAKE)... yes
checking whether to enable maintainer-specific portions of Makefiles... no
checking build system type... i686-pc-linux-gnu
checking host system type... i686-pc-linux-gnu
tubbo / pert.rb
Last active Feb 13, 2017
PERT estimation calculator
View pert.rb
#!/usr/bin/env ruby
# PERT Calculator v1.0.0
# To install, place this file in a directory that is in your $PATH. On
# my machine, I have ~/bin in my $PATH, so that's where `pert` lives.
# Example:
# $ pert 0.35 0.75 1
View Terminal
(irb):3: warning: toplevel constant Note referenced by Game::Note
=> #<Note id: nil, article_id: nil, type: nil, category: nil, body: nil, cite_url: nil, cite_title: nil, cite_website: nil, created_by_id: nil, created_at: nil, updated_at: nil>
# ^^ This is a new Note class object, not a Game::Note class object
View models.rb
class User < ActiveRecord::Base
has_many :memberships
has_many :groups, through: :memberships
class Group < ActiveRecord::Base
has_many :memberships
has_many :members, class_name: 'User', through: :memberships
View order.rb
class Order < ApplicationRecord
has_many :order_items, dependent: :destroy
def amount
order_items.sum :total_price
tubbo / activeadmin.rb
Last active Dec 13, 2016 — forked from bennyzr/gist:0bd5d7c59c69010dec73fa4576a5a04d
Insert tag into Active Admin body tag to disable turbolinks
View activeadmin.rb
ActiveAdmin::Views::Pages::Base.class_eval do
def build(*args)
def add_attributes_to_body
View index.html.erb
<div class='main-content'>
<h2 class='greeting'>Free hi-res stock images for both personal & commercial use.</h2>
<ul class='optionsnavi'>
<li class='dropdown'>
<button class='dropbtn'>
Sort By <i class="fa fa-sort-desc" aria-hidden="true"></i>
<div id='myDropdown' class='dropdown-content'>
<%= link_to "Latest", :sort => "created_at asc" %>
You can’t perform that action at this time.