Skip to content

Instantly share code, notes, and snippets.

😎
it's been a long time, I shouldn't have left you...without a byebug to step thru

Tom Scott tubbo

😎
it's been a long time, I shouldn't have left you...without a byebug to step thru
View GitHub Profile
@tubbo
tubbo / ports.conf
Created Apr 9, 2011
apache2/ports.conf
View 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
View 01-generic-methods.go
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 / 1old.js
Created Apr 4, 2020
new syntax for changing how this-binding to functions works. just an idea for now.
View 1old.js
class App {
ready() {
alert("hello")
}
}
const app = new App()
document.addEventListener("DOMContentLoaded", app.ready.bind(app))
// or
@tubbo
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 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 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
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
end
class NotificationPreference < ActiveRecord::Base
belongs_to :notifee, polymorphic: true
end
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
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
Game::Note.new
(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
You can’t perform that action at this time.