a day of python, and palette experiments
blog updates
10.47, i finished adding blog pages to the homepage.
notes to self:
-
may need to add more to the preview - replace green squares with a thumbnail
-
catchup writing blog pages tomorrow and the following day
-
for the rest of the blogs, write the blog for that day the next morning!
datacamp streak reactivated!!
i haven't touched my datacamp subscription for a few weeks, and it's definitely time to get back on it -
can't be wasting money like that.
i'll use this blog as a notes page too now (starts at chapter 2 since i finished chapter 1 of this course
back in april).
writing function in python - chapter 2: context managers
-
using context managers
-
a function that sets up the context for your code to run in, runs the code, then removes the context
-
analogy given: caterers - they set up the tables with food and drinks, allows the party to go on, then cleans up the tables once the party is over
-
code example: the open() function. it opens a file,, lets you run code to do with the file, then closes the file when you’re done
(always evident when you use 'with')
-
writing context managers
-
two ways of making them: class-based, and function-based
-
step to creating a context manager
-
define the function
-
set up code the context needs (optional)
-
use the yield keyword (returns a value but expects to complete the rest of the function)
-
add any teardown code the context needs (optional)
-
add `@contextlib.contextmanager` decorator
-
a context manager is technically a generator function that yields a single value
-
advanced topics
-
error handling
-
use the try except statement within the context manager
try:
yield
finally:
#rest of code
-
patterns
-
open, close
-
lock, release
-
change, reset
-
enter, exit
-
start, stop
-
setup, teardown
-
connect, disconnect
writing function in python - chapter 3: decorators
-
functions are objects
-
you can store a function my_function() in a variable x and then call x(). when referencing them, don’t use parenthesis (reference them, don’t call them)
-
you can do this with print!! oh my
-
you can put them in lists, or even dictionaries then reference their index and pass arguments into them!!
-
you can also pass functions as arguments into other functions
-
they can be return values too
-
scope
-
variables declared outside of the function are global
-
inside a function,, it’ll look in the local scope
-
checks for local scope,, then global scope,, then built-in scope
-
nonlocal scope is checked when a parent function is defined (sought through before the global scope).
when updating a variable declared in parent function, use the nonlocal keyword to define it in the child function
-
closures
-
a tuple of variables that are no longer in scope but the function still needs to run
-
attaches nonlocal variables to a returned function so it can work even when it is called outside of the parent’s scope
-
i think i’ve done this before in the mastermind project before un-childing functions for testing reasons
-
decorator
-
a wrapper put around a function that modifies its behaviour
-
looks like: @decorateName
-
functions that take a function as an argument and returns a modified version of that function
-
to return a modified function, define a new function to return within the decorator
writing function in python - chapter 4: more on decorators
-
real-world examples
-
timer decorator - prints how long a function took to run
-
memoize decorator - stores the results of a function so next time the function is called with the same arguments, you can just lookup the answer (like cache)
-
use decorators when you want to add common bits of code to multiple functions
-
decorators and metadata
-
decorators obscure the decorated function’s metadata
-
python has a fix for this: the wraps decorator (imported from functools), taking the function you’re decorating as an argument
the trilogy: french, german, and japanese
by 13.21 i finished all my language dailies.
french: elementary a2 - 1.3 the passé composé: être and avoir
french |
english |
Ils ont regardé la télé et je me suis reposé au lit. |
They watched TV and I rested in bed. |
Nous nous sommes reposés et elle a lu un livre. |
We rested and she read a book. |
Sandra est sortie. |
Sandra went out. |
Tu es resté tard au travail? |
Did you stay late at work? |
german: elementary a2 - 1.3 talking about the past weekend
german |
english |
Das Wetter war so gut! |
The weather was so good! |
Ich war am Samstag und am Sonntag im Park. |
I was in the park on Saturday and on Sunday. |
Ich war zu Hause und hatte online Gitarren-Unterricht. |
I was at home and I had online guitar lessons. |
Was hast du am Wochenende gemacht? |
What did you do at the weekend? |
japanese: elementary a1 - 1.3 introducing yourself
japanese |
romanised |
english |
どうぞ よろしく。 |
Douzo yoroshiku. |
Pleased to meet you. |
はじめまして。 わたし わ まな です。 どうぞ よろしく。 |
Hajimemashite. Watashi wa Mana desu. Douzo yoroshiku. |
Nice to meet you. I am Mana. Pleased to meet you. |
fire on marz(z)
i love benee's album 'fire on marzz', but that's not what this section's about.
fire on marz. my art universe.
one of my goals this summer was to get back into art, well more so my webcomic art world. and since i am currently in a
web design frenzy of learning fonts, optimal colour palettes, and website flow, why not make a website dedicated to my webcomic too?
and here comes another project that i will probably start and not finish, but i'm hoping that this summer
will change that artistic trait of mine.
before even trying to design any webcomic branding, i searched up unique portfolios and saw a link on reddit
of a repository containing unique portfolio designs. some of the links are outdated so here are the valid ones
that i really liked:
-
lynn and tonic
- i’m not usually a fan of bright colours but of course, this design make me question my preferences
-
nuuneoi
- so cool! i love the gamified theme and it’s just so unique, definitely my favourite out of this batch
of portfolios
-
zenorocha
- the navigation of the site through key commands is such a cool feature, and the minimalistic style is very easy on the eyes
-
adamhartwig
- i like the revolving objects - i kind of want to do something like this for my fire on marz site (e.g. planets
of the solar system)
-
tim roussilhe
- the design, transitions and animations are insane
after going through impressive designs, i was ready to start planning on figma. one problem though.
colour scheme.
colour scheme is always a tricky bit for me, from figma design to picking markers to colour in my sketches,
it's always been a struggle. so, i did the next best thing, and spent the next half hour on coolors.
i'll spam the shortlisted palettes here.
i ended up settling for the second to last palette, removing bb9457 since i felt like it was ruining the
whole combination of colours
finally, onto the design!
i came across another struggle: font. but i ended up choosing after half an hour, to not waste time.
(i chose the orbitron font)
i tried mocking up business cards to see how i could use the font and colour palette (still simple but that'll
do for now).
at 18.42, i finished the day by completing a page in my sketchbook that i started yesterday. the character's faces
are very improportionate and the eye placement is making them look kooky - i think i may have just lost my eyeballing
technique again, whoopsy.