DaFluffyPotato's Blog

a blog for stuff I don't want to put on YouTube | main website

I've updated the website to support code in blog posts!

posted April 19, 2020 @ 07:25 UTC

I'll be able to post some code snippets in a useful way now.
```python
# this is embedded code
for i in range(10):
print('Hello world!')
```
I'm considering writing out a text version of my YouTube tutorials in the future, so I thought I'd implement this.

For the fun of it, I've added the code for my markup script below:
```python
import keyword
built_in_list = ['abs', 'delattr', 'hash', 'memoryview', 'set', 'all', 'dict', 'help', 'min', 'setattr', 'any', 'dir', 'hex', 'next', 'slice', 'ascii', 'divmod', 'id', 'object', 'sorted', 'bin', 'enumerate', 'input', 'oct', 'staticmethod', 'bool', 'eval', 'int', 'open', 'str', 'breakpoint', 'exec', 'isinstance', 'ord', 'sum', 'bytearray', 'filter', 'issubclass', 'pow', 'super', 'bytes', 'float', 'iter', 'print', 'tuple', 'callable', 'format', 'len', 'property', 'type', 'chr', 'frozenset', 'list', 'range', 'vars', 'classmethod', 'getattr', 'locals', 'repr', 'zip', 'compile', 'globals', 'map', 'reversed', '__import__', 'complex', 'hasattr', 'max', 'round']
keyword_list = keyword.kwlist

keyword_begin = ''
built_in_begin = ''
all_end = '
'

var_chars = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '_']

def parse_code(code, encoding):
parse_index = {
'python': parse_python_code,
}
if encoding in parse_index:
return parse_index[encoding](code)
else:
return parse_basic_code(code)

def parse_basic_code(code):
output = ''
for line in code.split('\n'):
line = line.replace('&', '&')
line = line.replace('<', '<')
line = line.replace('>', '>')
line = line.replace(' ', ' ')
line += '
'
output += line
return output

def parse_python_code(code):
output = ''
for line in code.split('\n'):
line = line.replace('&', '&')
line = line.replace('<', '<')
line = line.replace('>', '>')
line = line.replace(' ', ' ')
line += '
'
in_comment = False
in_string = False
current_word = ''
escape = False
for char in line:
char_pre = ''
char_post = ''
if char.lower() in var_chars:
current_word += char
else:
word_highlight_begin = ''
word_highlight_end = ''
if (not in_comment) and (not in_string):
if current_word in keyword_list:
word_highlight_begin = keyword_begin
word_highlight_end = all_end
if current_word in built_in_list:
word_highlight_begin = built_in_begin
word_highlight_end = all_end
if char in ['\'', '"']:
if not in_comment:
if not in_string:
in_string = char
char_pre = ''
elif not escape:
if char == in_string:
in_string = False
char_post = '
'
if char == '#':
if not in_string:
in_comment = True
char_pre = ''
output += word_highlight_begin + current_word + word_highlight_end + char_pre + char + char_post
current_word = ''
escape = False
if char == '\\':
escape = True
if (in_comment) or (in_string):
output = output[:-4] + '
' + output[-4:]

return output
```

comments | 6.5K views

Aeroblaster is Out!

posted February 24, 2020 @ 08:29 UTC

I made Aeroblaster in under 48 hours for the Alakajam! I feel like this is my best game jam entry so far.

Get it here:
https://cmlsc.itch.io/aeroblaster

comments | 5.76K views

My Font Sheet

posted February 17, 2020 @ 23:09 UTC

I just finished a new font today. I needed a bigger one than my 3x6 one I've been using for the past few years. Since I couldn't find anything when I looked for pixel art fonts (in the form of images instead of TTFs that don't scale well), I've decided to release both of my fonts into the public domain. I'll probably also make more pixel art fonts which I'll release into the public domain at some point.

Here's the file (click it to view it directly):


Here's an example of the fonts in use:

comments | 5.51K views

The Website is (mostly) Finished!

posted January 24, 2020 @ 00:09 UTC

I've finished all of the major pages for the website!
There is still some other stuff I'll do later. I'd like to add a newsletter feature. I'm planning on allowing people to sign up with either their email or their Discord ID so they can get PMed updates by my bot. I'd also like to change the Projects page later on so that it doesn't load all of the media for all my projects at once. At the moment it's about 20MB to load for the first time and that number will only increase.
I'll probably be posting on this blog more than I did with my last one because I had to manually add blog post text files for the last one. For this version, I've got a script for writing posts that can be submitted with a single command.
In other news, I've learned MongoDB for this project. It's a bit overkill, but I was doing it for the experience. I'm also significantly more comfortable with HTML and CSS now.

Anyways, I thought I'd leave y'all with some comparisons between this version of the website and the old version.

comments | 4.2K views

First Post

posted January 21, 2020 @ 20:27 UTC

This is the first post!

comments | 2.88K views