Skip to content

Instantly share code, notes, and snippets.

View desinas's full-sized avatar

Dimitrios Kalkasinas desinas

View GitHub Profile
@desinas
desinas / MLX42
Last active April 5, 2023 12:18
MLX42 Graph-lib - Codam Coding-college
NAME := Game
CFLAGS := -Wextra -Wall -Werror -Wunreachable-code -Ofast
LIBMLX := ./lib/MLX42
HEADERS := -I ./include -I $(LIBMLX)/include
LIBS := $(LIBMLX)/build/libmlx42.a -ldl -lglfw -pthread -lm
SRCS := $(shell find ./src -iname "*.c")
OBJS := ${SRCS:.c=.o}
all: libmlx $(NAME)
@desinas
desinas / Wordle.js
Created February 2, 2022 13:44 — forked from gaearon/Wordle.js
wordle v3 (tiny wordle clone i built during a stream) https://www.youtube.com/watch?v=Qxn4-bTOx0g
import { useState, useEffect, useRef, useMemo } from 'react'
export default function Wordle() {
let [currentAttempt, setCurrentAttempt] = useState('')
let [bestColors, setBestColors] = useState(() => new Map())
let [history, setHistory] = usePersistedHistory(h => {
waitForAnimation(h)
})
useEffect(() => {
@desinas
desinas / index.html
Last active July 24, 2023 14:35
progress-bar_implement
<div class="container">
<div class="progress-bar"></div>
</div>
<button onclick="loadBar()">Load</button>
@desinas
desinas / index.html
Last active May 25, 2019 08:56
React in a HTML file - Hello World// source https://jsbin.com/qayexuw
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8" />
<title>Hello World</title>
<script src="https://unpkg.com/react@16/umd/react.development.js"></script>
<script src="https://unpkg.com/react-dom@16/umd/react-dom.development.js"></script>
<!-- Don't use this in production: -->
<script src="https://unpkg.com/babel-standalone@6.15.0/babel.min.js"></script>
@desinas
desinas / exerc2_2-coursity.py
Created November 5, 2018 18:33
Coursity exerc2_1
import random
random.seed(100)
while True:
n=random.randrange(0,37,1)
if n == 0:
print("- Κληρώθηκε το 0.")
@desinas
desinas / exerc2_1-coursity.py
Created November 5, 2018 18:32
Coursity exerc2_1
import math
print("α, β και γ παριστάνουν σταθερούς αριθμούς και α δεν είναι 0")
a =int(input("Για το τριώνυμο αx²+βx+γ δώστε τον συντελεστή α: "))
b =int(input("Για το τριώνυμο αx²+βx+γ δώστε τον συντελεστή β: "))
c =int(input("Για το τριώνυμο αx²+βx+γ δώστε τον συντελεστή γ: "))
d=b**2-4*a*c
print("Η διακρίνουσα Δ=β²-4αγ είναι ", d)
@desinas
desinas / _Contacts-onReact-srcApp.js
Last active July 18, 2018 15:05
part of Contacts app after bootstrapping w/ Create React app of Udacity React nano-degree
import React, { Component } from 'react';
import { Route } from 'react-router-dom'
import ListContacts from './ListContacts'
import CreateContact from './CreateContact'
import * as ContactsAPI from './utils/ContactsAPI'
class App extends Component {
state = {
contacts: []
}
@desinas
desinas / index.js
Last active June 19, 2018 10:38
Wittr app for Service Worker intro
self.addEventListener('install', function(event) {
event.waitUntil(
caches.open('wittr-static-v1').then(function(cache) {
return cache.addAll([
'/',
'js/main.js',
'css/main.css',
'imgs/icon.png',
'https://fonts.gstatic.com/s/roboto/v15/2UX7WLTfW3W8TclTUvlFyQ.woff',
'https://fonts.gstatic.com/s/roboto/v15/d-6IYplOFocCacKzxwXSOD8E0i7KZn-EPnyo3HZu7kw.woff'
@desinas
desinas / useMap-Filter_callback.js
Last active May 25, 2019 15:52
Callback Functions at Runtime by Udacity FrontENDev
/* Using filter()
*
* Using the musicData array and filter():
* - Return only album objects where the album's name is
* 10 characters long, 25 characters long, or anywhere in between
* - Store the returned data in a new `results` variable
*
* Note:
* - Do not delete the musicData variable
* - Do not alter any of the musicData content
@desinas
desinas / addContentEfficiently.js
Last active September 12, 2023 06:44
Add Page Content Efficiently - Performance - FrontENDev
const fragment = document.createDocumentFragment(); // ← uses a DocumentFragment instead of a <div>
for (let i = 0; i < 200; i++) {
const newElement = document.createElement('p');
newElement.innerText = 'This is paragraph number ' + i;
fragment.appendChild(newElement);
}
document.body.appendChild(fragment); // reflow and repaint here -- once!