Skip to content

Instantly share code, notes, and snippets.

// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Using_promises
// https://scotch.io/tutorials/javascript-promises-for-dummies
// https://www.youtube.com/watch?v=s6SH72uAn3Q
// 1.
// doSomething(function(result) {
// doSomethingElse(result, function(newResult) {
// doThirdThing(newResult, function(finalResult) {
@aoloe
aoloe / scribus-add-plugin-windws-alpha.md
Last active February 22, 2019 14:28
instructions by aiena for compiling scribus on windows

Adding a plugin to the the Visual Studio project

  • In Visual Studio create a GUID of type registry with Tools > Create GUID

  • in win32/msvc2015/Scribus.sln add after the last plugin (Project):

Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "pluginname", "pluginname\pluginname.vcxproj", "{GUID-GENERATED-BY-VISUAL-STUDIO}"
    ProjectSection(ProjectDependencies) = postProject
        {B17FCD80-7978-4544-93C4-2FE1AC6FE9F3} = {B17FCD80-7978-4544-93C4-2FE1AC6FE9F3}
@aoloe
aoloe / collide.py
Last active November 8, 2018 16:32
WIDTH = 640
HEIGHT = 480
BLACK = (0, 0, 0)
RED = (120, 0, 0)
box = Rect((100, 100), (100, 100), anchor=('left', 'top'))
player = Rect((300, 100), (100, 100), anchor=('left', 'top'))
def update(dt):
#include <iostream>
#include <string>
#include <cassert>
std::string get_alter_typ(int alter)
{
std::string typ{}; // typ definiert
if (alter < 18) // alter vergleichen
{
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
#!/usr/bin/python3.6
import os
import sys
import argparse
import re
from subprocess import call
parser = argparse.ArgumentParser(description='Convert a svn referenced in a markdown line into png.')
parser.add_argument('lines', nargs='?', type=argparse.FileType('r'), default=sys.stdin)
@aoloe
aoloe / README.md
Last active July 10, 2018 09:52
Python classes for exercising the adapter pattern

Adapter pattern with Python: the music player

Without modifying:

  • the Media_player_audio and Media_player_video interfaces
  • nor the Media_player_mp4 class

add an adapter that allows the music player to play the sound of an mp4 file.

Lists sum problem

You are given two lists a and b with integers, that also can be negative, and a target sum.

Task:

  • find a function that returns true if two numbers in the list can be added to build the target sum.
@aoloe
aoloe / main.py
Created May 7, 2018 12:39
Python: Find the distance between points
#!/usr/bin/env python3
import math
from itertools import accumulate
from functools import reduce
points = [(1,2), (2,1), (5,3)]
# points = [[1,2], [2,1], [5,3]]
print(points)
@aoloe
aoloe / CMakeLists.txt
Last active March 21, 2018 14:40
Refactoring AObjects
CMAKE_MINIMUM_REQUIRED(VERSION 3.4)
PROJECT(align-objects)
SET(CMAKE_CXX_STANDARD 14)
set(CMAKE_INCLUDE_CURRENT_DIR ON)
set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTORCC ON)