Skip to content

Instantly share code, notes, and snippets.

View JakubGrobelny's full-sized avatar
🤔

Jakub Grobelny JakubGrobelny

🤔
  • Vewd/Xperi
  • Wrocław, Poland
View GitHub Profile
cmake_minimum_required(VERSION 3.15)
project(program_name VERSION 0.0.1)
set(CMAKE_CXX_FLAGS "-Wall -Wextra -pedantic --std=c++17 -Og -fsanitize=address,undefined")
set(CMAKE_CXX_FLAGS_RELEASE "-Wall -Wextra -pedantic --std=c++17 -Werror -O2")
file(GLOB_RECURSE SOURCES src/*.hpp src/*.cpp)
include_directories(${CMAKE_SOURCE_DIR})
@JakubGrobelny
JakubGrobelny / c.hs
Last active October 21, 2020 00:39
Line of code using >>= valid in both C and Haskell
char s [] = {-1 }; int main () {int a = 0; /*-}2137{-*/ int xd[] = {a--}; short id = 0; long Nothing = 0; a = Nothing >>= id; --a;}
#include <math.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <stdint.h>
#ifndef M_PI
#define M_PI 3.14159265358979323846
#endif
@JakubGrobelny
JakubGrobelny / format.cpp
Last active January 15, 2019 00:44
Simple C++ string formatiing
#include <string>
namespace implementation
{
template <typename T>
inline auto stringify(const T& t) -> std::string
{
return std::to_string(t);
}
@JakubGrobelny
JakubGrobelny / Makefile
Created August 15, 2018 00:07
Makefile
COMPILER = # FILL # compiler
FLAGS = # FILL # compiler flags
LIBS = # FILL # linked libraries
TARGET = # FILL # name (and path) of the executable
# to use with .cpp change *.c to *.cpp
SRC = $(shell find src -name "*.c")
OBJ = $(patsubst src/%.c, build/%.o, $(SRC))
DEP = $(OBJ:%.o=%.d)
#lang racket
;; arithmetic expressions
(define (const? t)
(number? t))
(define (op? t)
(and (list? t)
(member (car t) '(+ - * / = > >= <= <))))
@JakubGrobelny
JakubGrobelny / objective-racket.rkt
Created April 7, 2018 20:43
Objective programming with functions only
#lang racket
;; creating class-like abstractions using functions only
(define (animal name) ; abstract class
(lambda (member)
(cond
[(or (eq? member 'type)
(eq? member 'base-type)) 'animal ]
[(eq? member 'name) name ]