Skip to content

Instantly share code, notes, and snippets.

View tubbo's full-sized avatar
😎
losing my sight, losing my mind, go to the general to save some time

Tom Scott tubbo

😎
losing my sight, losing my mind, go to the general to save some time
View GitHub Profile
@tubbo
tubbo / ports.conf
Created April 9, 2011 21:33
apache2/ports.conf
# If you just change the port or add more ports here, you will likely also
# have to change the VirtualHost statement in
# /etc/apache2/sites-enabled/000-default
# This is also true if you have upgraded from before 2.2.9-3 (i.e. from
# Debian etch). See /usr/share/doc/apache2.2-common/NEWS.Debian.gz and
# README.Debian.gz
NameVirtualHost *:80
Listen 80
@tubbo
tubbo / models.rb
Last active March 21, 2021 21:32 — forked from mfifth/models.rb
class User < ActiveRecord::Base
has_many :memberships
has_many :groups, through: :memberships
end
class Group < ActiveRecord::Base
has_many :memberships
has_many :members, class_name: 'User', through: :memberships
end
@tubbo
tubbo / 1old.js
Created April 4, 2020 20:32
new syntax for changing how this-binding to functions works. just an idea for now.
class App {
ready() {
alert("hello")
}
}
const app = new App()
document.addEventListener("DOMContentLoaded", app.ready.bind(app))
// or
package main
type Addable interface {
Total int
Add(value int) int
}
func (addable *Addable) Add(value int) int {
addable.Total = addable.Total + value
@tubbo
tubbo / Dockerfile
Last active November 26, 2018 16:45
docker compose setup for soundstorm
#
# Docker image build script for Soundstorm
#
# Use latest Ruby
FROM ruby:2.5.3
# Install system dependencies
RUN curl -sL https://deb.nodesource.com/setup_8.x | bash - \
&& curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add - \
@tubbo
tubbo / gist:1368091
Created November 15, 2011 19:40
Diaspora Conversations Controller
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
tubbo / polymorphic.rb
Last active April 13, 2017 20:22 — forked from laspluviosillas/polymorphic.rb
Issue with polymorphic associations
class Task < ActiveRecord::Base
has_one :notification_preference, as: :notifee
accepts_nested_attributes_for :notification_preference
end
class NotificationPreference < ActiveRecord::Base
belongs_to :notifee, polymorphic: true
end
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
tubbo / pert.rb
Last active February 13, 2017 18:28
PERT estimation calculator
#!/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