Skip to content

Instantly share code, notes, and snippets.

View tebba-von-mathenstein's full-sized avatar

Tyler Bettilyon tebba-von-mathenstein

View GitHub Profile
@tebba-von-mathenstein
tebba-von-mathenstein / simpleBenchmark.js
Last active February 12, 2016 06:43
A lightweight benchmarking utility to compare multiple versions of a function
/**
* reports the speed of a function.
* Params:
* f: the function
* fParams: array, the parameters f will be called with.
* minTime: number, the minimum amount of time to run each function in seconds.
* verbose: boolean, print to the console if true.
*
* Returns:

Rails Co Pull Request Format

A pull request(PR) is a request for the organization to pull some of your work into the master codebase. This document codifies the rules for opening and merging a PR at RailsCo.

At RailsCo we take our craft very seriously so like any important piece of work, code undergoes an editorial phase before being merged. Pull requests are the main component of this editorial process, and they are the only acceptable way for code to enter the master codebase here at Rails Co.

Before You Open a PR

Because the editorial process is expensive, both in terms of mental power and time taken, there are a few things that must be done before a Sr. Engineer will look at your code. For each new feature or bugfix you submit, run through this checklist first:

// Function definition. This creats a function called reverseString
// which accepts one parameter.
function reverseString(inputString) {
var outputString = "";
for(var i = inputString.length - 1; i >= 0; i--) {
var currentChar = inputString[i];
outputString += currentChar;
}
// Get the user's choice
var userChoice = prompt("Rock, paper, or scissors?");
userChoice = userChoice.toLowerCase();
// Get the computer's choice
var computerChoice = Math.random();
// Teach the computer how to guess rock, paper, or scissors
if(computerChoice < .33) {
computerChoice = "rock";
@tebba-von-mathenstein
tebba-von-mathenstein / callable_number.js
Created June 28, 2017 17:57
Just one odditiy of JS
function CallableNumberGenerator(value, func) {
var selfFunction = function() {
var v = func.apply(null, arguments);
return CallableNumberGenerator(v, func);
}
var callableNumber = selfFunction.bind(null, value);
var value = value;

Multiplication & Big O

Addition In a Loop

It's easy to write the code for this algorithm:

def multiplication(a, b):
  product = 0
 for _ in range(b):
1. why does the sun shine
you answer here
3. why is the sky blue
youre answer ehre
@tebba-von-mathenstein
tebba-von-mathenstein / explore-dns-part-one-answers.md
Last active January 18, 2021 19:29
Answer key for the explore DNS part 1 exercise

Explore DNS With Dig

In this exercise you'll learn about DNS by using dig to make DNS queries. These are the primary objectives of this exercise:

  • Expose the different responsibilities of different members of the DNS hierarchy.
  • Explore how different DNS servers respond differently to different DNS queries.
  • Familiarize yourself with the different kinds of DNS record types, and distinguish between them.

dig is a command line tool that comes installed on most unix and linux systems, or can be installed with your favorite package manager. If not, you can use this web interface -- but the user experience is much worse so I strongly suggest you use the command line instead.

@tebba-von-mathenstein
tebba-von-mathenstein / explore-dns-part-one.md
Last active March 14, 2024 17:23
An exercise to help you learn about DNS and dig

Explore DNS With Dig

In this exercise you'll learn about DNS by using dig to make DNS queries. These are the primary objectives of this exercise:

  • Expose the different responsibilities of different members of the DNS hierarchy.
  • Explore how different DNS servers respond differently to different DNS queries.
  • Familiarize yourself with the different kinds of DNS record types, and distinguish between them.

dig is a command line tool that comes installed on most unix and linux systems, or can be installed with your favorite package manager. If not, you can use this web interface -- but the user experience is much worse so I strongly suggest you use the command line instead.

@tebba-von-mathenstein
tebba-von-mathenstein / explore-dns-part-two-answers.md
Last active January 18, 2021 19:28
An answer key for part two of exploring DNS

Explore DNS With Dig

In this exercise you'll learn about DNS by using dig to make DNS queries. These are the primary objectives of this exercise:

  • Expose the different responsibilities of different members of the DNS hierarchy.
  • Explore how different DNS servers respond differently to different DNS queries.
  • Familiarize yourself with the different kinds of DNS record types, and distinguish between them.

dig is a command line tool that comes installed on most unix and linux systems, or can be installed with your favorite package manager. If not, you can use this web interface -- but the user experience is much worse so I strongly suggest you use the command line instead.