Skip to content

Instantly share code, notes, and snippets.

@MelanieS
MelanieS / hello_world.py
Created March 12, 2025 19:26
Python hello world program
print("Hello, World!")
@MelanieS
MelanieS / website.html
Last active February 11, 2025 16:12
Adding a background image in HTML
#very basic website code for html background tutorial
<!DOCTYPE html>
<html>
<head
</head>
<body>
#remove <body>
#replace with <body style="background:url()">
@MelanieS
MelanieS / gist:23ac3c2cebe4e86f62ead25d5b6c8fb0
Last active February 7, 2025 10:34
deprecated, pulls A dna matches by side of family
// Check if page contains the text "Maternal side"
function checkPage(url, element, callback) {
let newTab = window.open(url, "_blank");
newTab.addEventListener("load", function onTabLoad() {
newTab.removeEventListener("load", onTabLoad);
let isMaternal = newTab.document.body.textContent.includes("Maternal side");
callback(isMaternal, element, newTab);
string = "This is a Ruby tutorial."
# This returns the index where the 1st instance of i occurs
string.index('i')
# This code returns 2
string = "This is a Ruby tutorial."
# Here we will return an array containing each instance of i
string.scan('i')
# This code returns ["i", "i", "i"]
string = 'This is a Ruby tutorial.'
string.count('i')
# This returns the integer 3
# case sensitive example
string.count('r')
# This returns the integer 1
string.count('r', + 'R')
# This returns the integer 2
@MelanieS
MelanieS / RollingDie.java
Last active April 2, 2019 18:03
RollingDie
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package rollingdie;
import java.util.Random;
import java.util.Scanner;
import java.util.*;
import java.util.Arrays;
rename "old" "new" *
# * means all files
@MelanieS
MelanieS / permute_tri.rb
Created September 11, 2015 02:38
permute_tri.rb
a = [60, -60]
# 4 refers to number of 60s or -60s in each element of array
a = a.repeated_permutation(6).to_a
puts "The array contains #{a.length} elements."
#creates output file called permute.txt
out_file = File.new("permute_out.txt", "w")
@MelanieS
MelanieS / course_tracker
Created July 9, 2014 20:15
PNC course tracker
#Purdue North Central doesn't have waitlists, but you can get notified of seat availability with this app
require 'rubygems'
require 'open-uri'
require 'hpricot'
require 'twilio-ruby'
availability = 0
puts "Enter the CRN for the PNC course you would like to track:"
crn = gets.chomp.to_s