This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Hello... World | |
use_bpm 75 | |
use_synth :fm | |
in_thread do | |
loop do | |
cue :tick | |
sleep 1 | |
end | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Mixer ######################################## | |
theme_channel = 1 | |
bass_channel = 0 | |
slicer_channel = 0 | |
sparkle_channel = 0 | |
# Fader ######################################## | |
overall_volume = 1 | |
bass_volume = 0.5 | |
sparkle_volume = 1 | |
sparkle_speed = 0.125 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library(yaml) | |
# setwd("~/directory/to/nile/configs") | |
# Create data frame with desired input fields | |
yamlFile <- yaml.load_file("nile.yml") | |
# Load configurations into a dataframe | |
df <- data.frame( | |
lapply( |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def binary_search(ordered_list, search_item): | |
# If the length of the list is zero, it's empty, | |
# so the search_item can't be in the list. | |
if len(ordered_list) == 0: | |
return False | |
# Otherwise, let's try to find the item... | |
else: | |
middle_item = len(ordered_list) // 2 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Here's a list of 5 people. | |
example_array = ["Alice", "Bob", "Jess", "Lisa", "Susan"] | |
middle = len(example_array) // 2 | |
# This is shorthand for saying: "Give me the first half of the array" | |
# This is equivalent to example_array[0:middle] | |
first_half = example_array[:middle] | |
# ['Alice', 'Bob'] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def selection_sort(input_list): | |
# Save the length of the list | |
n = len(input_list) | |
# NOTE: In Python, enumerate returns an index, value pair. | |
# The _ means that we're ignoring the value. | |
for current_index, _ in enumerate(input_list): | |
# Save the location of the smallest item in the list | |
smallest_index = current_index |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def merge_sort(input_list): | |
""" | |
merge_sort is a divide-and-conquer algorithm that repeatedly breaks | |
down the large task of sorting into smaller sub-problems that are | |
much easier given the following insight: | |
Insight 1: If the list only contains 1 element, it's already sorted. | |
Insight 2: If you have two lists that are already sorted, you can merge | |
the two sorted lists to create a larger sorted list. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// This file includes the reasoning behind my manual minification choices. | |
// I wouldn't write code like this for an actual project because if I | |
// looked at this code in 2 months, I'd probably say WTF. | |
function largestCommonSubstring(a, b) { | |
// Use one declaration to minimize the number of let statements | |
let l = 0, // Length of the longest common substring | |
s = '', // Substring to return | |
// Generate mxn array filled with zeroes | |
// I would probably call this "lcs" in a real project, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function gameOfLifeIterator(board) { | |
let returnBoard = []; | |
for (let i = 0; i < board.length; i++) { | |
returnBoard[i] = []; | |
for (let j = 0; j < board[i].length; j++) { | |
let neighborCount = getCellNeighborCount(i, j, board); | |
if (board[i][j] === 1) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function getCellNeighborCount (x, y, board) { | |
let neighborCount = 0 | |
if (isAlive(x - 1, y - 1)) neighborCount++ | |
if (isAlive(x - 1, y)) neighborCount++ | |
if (isAlive(x - 1, y + 1)) neighborCount++ | |
if (isAlive(x, y - 1)) neighborCount++ | |
if (isAlive(x, y + 1)) neighborCount++ | |
if (isAlive(x + 1, y - 1)) neighborCount++ | |
if (isAlive(x + 1, y)) neighborCount++ | |
if (isAlive(x + 1, y + 1)) neighborCount++ |
OlderNewer