Skip to content

Instantly share code, notes, and snippets.

View toby-1-kenobi's full-sized avatar
💭
Getting Rev79 ready for international

Toby Anderson toby-1-kenobi

💭
Getting Rev79 ready for international
View GitHub Profile
@toby-1-kenobi
toby-1-kenobi / quicksort.rb
Last active September 2, 2018 21:25
use two methods that call each other to sort penguins with quicksort in an alternating fashion
##
# This is a demonstration of a valid reason for having two methods that call each other.
# It is part of a response to a queuestion online
# https://softwareengineering.stackexchange.com/questions/376333/is-2-methods-calling-each-other-code-smell/377660#377660
#
# See a video of me making this at https://youtu.be/YugJV21W91A
#
# we are using recursion to implement quicksort.
# The sort is implemented two slightly different ways
# and each way calls the other to do the next level down the tree.
@toby-1-kenobi
toby-1-kenobi / easy-paper-tabs.html
Last active September 19, 2016 07:21
A web component that encapsulates paper-tabs and iron-pages of Google's Polymer project so that they work together.
<!--
author: Toby Anderson
licence: Creative Commons Attribution-ShareAlike 4.0 International (https://creativecommons.org/licenses/by-sa/4.0/legalcode)
-->
<link rel="import" href="../paper-tabs/paper-tabs.html">
<link rel="import" href="../iron-pages/iron-pages.html">
<!--
@toby-1-kenobi
toby-1-kenobi / fixture_parser.rb
Last active November 12, 2019 15:36
Parse rails fixtures to seed the database without destroying or duplicating data
# Parse fixture files to seed the database in a non-destructive way
# duplicates are avoided and you may specify if the fields of an
# existing record should be updated.
module FixtureParser
require 'yaml'
# files_options_hash has fixtures file names as keys and then a hash like this as values