Skip to content

Instantly share code, notes, and snippets.

View msyvr's full-sized avatar
🎯
Focusing

Monica Spisar msyvr

🎯
Focusing
View GitHub Profile
@msyvr
msyvr / hangman_orig.py
Last active November 24, 2021 04:21
another version of the simple word guess/hangman game in python
import string
import random
from words_json import words
# randomly select word from words list
# don't allow words with spaces or dashes
def get_valid_word(words):
word = random.choice(words)
while ' ' in word or '-' in word:
word = random.choice(words)
@msyvr
msyvr / hangman.py
Last active November 24, 2021 04:22
simple word guessing game with limited guesses (hangman)
# select letters one at a time to guess mystery word
import string
import random
from words_json import words
def get_valid_word(words):
word = random.choice(words)
while '-' in word or ' ' in word:
word = random.choice(words)
@msyvr
msyvr / bot-guess-num--rand.py
Last active October 16, 2021 03:31
bot randomly guesses the player's number
# resource: https://youtu.be/8ext9G7xspg?t=431
import random
min = int(input("What's the minimum integer for the number guessing game?: "))
max = int(input("What's the maximum integer for the number guessing game?: "))
# choose which game to play by calling it (end of this file - scroll down)
# player guesses which number the computer randomly chose from a range
def guess(min, max):
# resource: https://youtu.be/8ext9G7xspg
# simple madlibs game: player chooses some words that get inserted into predefined sentence
adj = input("Adjective: ")
verb1 = input("Verb: ")
verb2 = input("Another verb: ")
famous_person = input("Famous person: ")
madlib = f"Computer programming is so {adj}! It makes me so excited because I love to {verb1}. Stay hydrated and {verb2} like you are {famous_person}!"
resource: https://opensource.com/article/19/5/python-3-default-mac
---
essentials:
1. Install pyenv:
$ brew install pyenv
2. Install desired version of python:
$ pyenv install 3.9.0
3. Set global default version
$ pyenv global 3.9.0
4. Verify it worked
@msyvr
msyvr / tictactoe.py
Last active September 2, 2021 19:45
import random
rowIndex = [1,2,3]
colIndex = [1,2,3]
diagset=[(1,1), (2,2), (3,3)]
antidiagset=[(1,3), (2,2), (3,1)]
availablePositions=[]
playerPositions=[]
computerPositions=[]
pDiagCount=0
pAntiDiagCount=0

Keybase proof

I hereby claim:

  • I am msyvr on github.
  • I am msyvr (https://keybase.io/msyvr) on keybase.
  • I have a public key ASA5Asjl0IcJvQ0lW5gTNdCJQtPaOPcXeInFC6ZdjLO1hQo

To claim this, I am signing this object:

Keybase proof

I hereby claim:

  • I am msyvr on github.
  • I am msyvr (https://keybase.io/msyvr) on keybase.
  • I have a public key ASA5Asjl0IcJvQ0lW5gTNdCJQtPaOPcXeInFC6ZdjLO1hQo

To claim this, I am signing this object:

This details how best to manage assets in the rails pipeline for deployment to heroku:
http://www.akitaonrails.com/2017/06/28/rails-5-1-heroku-deployment-checklist-for-heroku
"
Make sure you have 2 boot files, first the canonical Procfile to be used by Heroku in production:
1 web: bin/rails server -p $PORT -b 0.0.0.0
Second, a Procfile.dev to be used only in your development environment:
1 web: ./bin/rails server
@msyvr
msyvr / rails 5 asset pipeline management: fonts
Last active August 15, 2023 22:53
Getting custom fonts to work for Rails 5 app deployed to Heroku.
I deployed to Heroku and custom fonts didn't work. Details of my starting point below.
Fixed in 2 steps:
1. In application.rb file, in class Application < Rails::Application, added:
config.assets.paths << Rails.root.join("app","assets","fonts")
2. In application.scss file, in @font-face, changed src: url('...') to font-url('...'); e.g.:
src: font-url('Aileron/Aileron-Regular.otf') format('opentype');
Redeployed to Heroku and custom fonts worked.
---
Starting point details (this all worked for a local deploy, but not when deployed on Heroku):