Skip to content

Instantly share code, notes, and snippets.

View harrisonmalone's full-sized avatar

Harrison Malone harrisonmalone

View GitHub Profile

Cronjobs

really just wanted to understand more about cronjobs so i dug into it a bit

this was the best article that i could find that explained how to do something simple in node js

things that weren't explained well were for tidbits like all cronjobs start in your home directory and you have to cd into things to do it in particular places on your computer

once i had it work in the home directory the cd part wasn't too bad

@harrisonmalone
harrisonmalone / class_syntax.rb
Last active February 10, 2019 22:32
reminder on some basic ruby syntax
class Car
@@count = 0
def initialize(hash)
@brand = hash[:brand]
@color = hash[:color]
@@count += 1
end
def self.countCars
p @@count
@harrisonmalone
harrisonmalone / python_fund.py
Last active February 12, 2019 05:16
playing around with python fundamentals and main method
def hello_world():
return 'hello world'
def another_method():
print(hello_world())
list = [1,2,3,4]
list.append(5)
@harrisonmalone
harrisonmalone / soccer.py
Last active February 12, 2019 05:17
first code wars problem solved in python
def points(games):
three_points = []
one_point = []
for game in games:
home_team = game[0]
away_team = game[-1]
if home_team > away_team:
three_points.append(3)
if home_team == away_team:
one_point.append(1)
@harrisonmalone
harrisonmalone / Dog.py
Last active February 12, 2019 06:32
basic class and objects example
class Dog():
total_dogs = 0
def __init__(self, name):
self.name = name
# every time you initialize you add to the class variable
Dog.total_dogs += 1
def speak(self):
# you need to pass self as a parameter for instance methods
return 'woof!'
@harrisonmalone
harrisonmalone / index.html
Last active February 12, 2019 11:07
slide show with vanilla js
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Orientation Day</title>
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.7.1/css/all.css" integrity="sha384-fnmOCqbTlWIlj8LyTjo7mOUStjsKC4pOpQbqyi7RrhN7udi9RwhKkMHpvLbHG9Sr" crossorigin="anonymous">
<link rel="stylesheet" href="style.css">
</head>
arr = [1, 2, 3, 4]
new_arr = arr.map do |num|
num * 20
end
puts new_arr
=> [20, 40, 60, 80]
@harrisonmalone
harrisonmalone / user.rb
Last active February 21, 2019 00:37
a basic implementation of rspec
def sum(num1, num2)
# make this sum return 5
return (num1 + num2) + 1
end
def get_string
return "hello there"
end
def generate_random_number
for i in range(100, 0, -1):
print(f'{i} bottles of beer on the wall {i} bottles of beer')
print()
print(f'you take one down pass it around {i - 1} bottles of beer on the wall')
print()
import numpy as np
def add_list(list, list2=None):
"""method that sums a list
Args:
list ([type]): list with 1 2 3 in it
list2 ([type], optional): Defaults to None. testing out how docstring
deals with default arguments
Returns: