Skip to content

Instantly share code, notes, and snippets.

View d11z's full-sized avatar
:octocat:
Learning

d11z d11z

:octocat:
Learning
View GitHub Profile
@d11z
d11z / Quirks of C.md
Created March 18, 2022 18:42 — forked from fay59/Quirks of C.md
Quirks of C

Here's a list of mildly interesting things about the C language that I learned mostly by consuming Clang's ASTs. Although surprises are getting sparser, I might continue to update this document over time.

There are many more mildly interesting features of C++, but the language is literally known for being weird, whereas C is usually considered smaller and simpler, so this is (almost) only about C.

1. Combined type and variable/field declaration, inside a struct scope [https://godbolt.org/g/Rh94Go]

struct foo {
   struct bar {
 int x;

Keybase proof

I hereby claim:

  • I am d11z on github.
  • I am dbas (https://keybase.io/dbas) on keybase.
  • I have a public key ASDVQXYdqP2jC4kp-gWLJ8tjnsSMKHWRTNFW0f7-6ot6gwo

To claim this, I am signing this object:

@host = http://localhost:8080/api
###
# @name register
POST {{host}}/login
Content-Type: application/json
{
"username": "tester",
"password": "password"

Reddit clone

User stories

  • As a user, I should be able to sign up
  • As a user, I should be able to log in
  • As a user, I should be able to view popular posts from all sub-reddits
  • As a user, I should be able to view popular posts from a single sub-reddit
  • As a user, I should be able to create a post to a particular sub-reddit
  • As a user, I should be able to vote a post up or down
As a user, I should be able to sign up
As a user, I should be able to log in
As a user, I should be able to view popular posts from all sub-reddits
As a user, I should be able to view popular posts from a single sub-reddit
As a user, I should be able to create a post to a particular sub-reddit
As a user, I should be able to vote a post up or down
As a user, I should be able to leave a comment on a post
As a user, I should be able to view comments on a particular post
As a user, I should be able to vote a comment up or down
@d11z
d11z / scopequestions.txt
Last active April 18, 2018 19:13
Thinkful In Your Own Words
What is scope?
Scope determines whether variables can or can't be accessed in different places in your code. Globally scoped variables can be accessed anywhere in your code. When a variable is declared outside of a function it is globally scoped. Global scope can span across different files. Variables defined inside functions are locally scoped, meaning they can only be accessed within that function. This means that variable names can have the same name as long as they are defined in different fuctions. You can define a variable with the same name as a global variable inside of a function and it will be seperate from the global variable.
Why are global variables avoided?
We avoid global variables because they can cause unintended side effects. This can lead to code that is difficult to debug.
Explain JavaScript's strict mode

Keybase proof

I hereby claim:

  • I am d11z on github.
  • I am dbas (https://keybase.io/dbas) on keybase.
  • I have a public key whose fingerprint is B41E 1C4D DAA9 6692 2A4F 9A8F A0C0 17A7 382C A4E9

To claim this, I am signing this object: