Skip to content

Instantly share code, notes, and snippets.

View jcolebot's full-sized avatar

Jonathan "JC" Coley jcolebot

View GitHub Profile
@jcolebot
jcolebot / bottles99.js
Last active August 24, 2021 13:14
99 bottles of beer song using while loop in JS
var currentCount = 99;
function bottles99() {
while (currentCount > 0) {
console.log( currentCount + " bottle(s) of beer on the wall, " + currentCount + " bottle(s) of beer."
+ " Take 1 down, pass it around, " + (currentCount - 1) + " bottle(s) of beer on the wall")
currentCount--;
}
}
bottles99();
@jcolebot
jcolebot / index.js
Last active February 23, 2021 16:47
FizzBuzz function in JavaScript
function fizzBuzz() {
for (var count = 1; count <= 100; count++) {
if (count % 15 == 0) {
console.log("FizzBuzz");
}
else if (count % 3 == 0) {
console.log("Fizz");
}
else if (count % 5 == 0) {
console.log("Buzz");
@jcolebot
jcolebot / discoboxes.html
Created November 24, 2020 19:31
Disco color boxes. Colors change randomly on hover over.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Random Colored Boxes</title>
<style>
.grid {
display: grid;
@jcolebot
jcolebot / academycalculator.html
Created November 5, 2020 21:42
Instruct JS, CSS Calculator
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
<style>
.button {
background-color: grey;
border: solid 3px darkgray;
@jcolebot
jcolebot / GroupTwitter.cs
Created October 23, 2020 15:02
Group Twitter Featuring Password Function
using System;
using System.Data.SqlClient;
using System.Reflection.Metadata.Ecma335;
namespace Day24GroupTwitter
{
class Program
{
static void Main(string[] args)
{
@jcolebot
jcolebot / GroupNotTwitter.cs
Last active November 18, 2020 01:05
Group project NotTwitter in C#
using System;
using System.Data.Common;
using System.Data.SqlClient;
using System.Reflection;
using System.Reflection.Metadata.Ecma335;
using System.Runtime.CompilerServices;
namespace W4D4_DatabaseTwitter
{
@jcolebot
jcolebot / gsub_regex_note.rb
Last active November 18, 2020 01:10
Notes and examples of .gsub and Regex
# what is an enumerator?
# see enumerable: https://ruby-doc.org/core-2.7.2/Enumerable.html
# it is the thing that points to each part of a collection
# "hello".each_char do |letter|
# puts letter
# end
# what is gsub?
# global substitution
puts "hello".sub("he", "jean") # jeanllo
@jcolebot
jcolebot / morse_ruby_specb.rb
Created October 13, 2020 15:07
Ruby Rspec Variable Example
require './morse_converter'
describe MorseConverter do
# let creates a variable that you can use in each test under this same context
let(:converter) { MorseConverter.new }
# don't worry too much about this!
# before(:each) do
# @input = "a"
# end
@jcolebot
jcolebot / morse_ruby_spec_a.rb
Created October 13, 2020 15:05
Rspec Examples
require './morse_converter'
describe MorseConverter do
it "sets up testing properly" do
# expect means a line that makes the test pass/fail
expect(true).to be true
expect(true).to eql(true)
end
it "can convert a to .-" do
@jcolebot
jcolebot / basic_snake_game.rb
Last active May 15, 2024 11:42
2D Snake Game made with Ruby
require 'ruby2d'
#you can install Ruby 2D on WIN by entering "gem install ruby2d" in the terminal
set background: 'black'
set fps_cap: 20
#grid size is 20 pixels
SQUARE_SIZE = 20
#for default window size of 480px * 640px, width is 32 (640/20) and height is 24 (480/20) at grid size = 20 pixels
GRID_WIDTH = Window.width / SQUARE_SIZE
GRID_HEIGHT = Window.height / SQUARE_SIZE