sudo apt-get install libsdl2-dev
will install the SDL2 development library files. Headers will be in/usr/include/SDL2
.sudo apt-get install build-essential
to get compilers.- Install VSCode from market place.
- Install VSCode C++ extension.
- Set
"/usr/include"
and"/usr/include/SDL2"
inside theincludePath
array in VSCode either for current project or as default include path in settings. - Create main.cpp and put this insde:
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
useEffect(() => { | |
let isMounted = true; // Used to make sure we don't make state update after component dismount. | |
const socket = io('ws://localhost:5000/live'); | |
socket.on('connect', function () { | |
console.log('CONNECTED'); | |
}); | |
socket.on('disconnect', function () { | |
console.log('DISCONNECTED'); | |
}); | |
socket.on('update', function (payload: any) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def square_numbers(nums): | |
for i in nums: | |
yield(i*i) | |
mynums = square_numbers([1,2,3]) | |
for num in mynums: | |
print(num) | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React, { useState } from 'react'; | |
import FeatureHeading from '../components/FeatureHeading'; | |
import { io } from 'socket.io-client'; | |
import { useEffect } from 'react'; | |
export default function LiveFeedView() { | |
/** Create socket conenction. */ | |
const [live, setLive] = useState(null); |
- Download development library from https://www.libsdl.org/download-2.0.php
- From extracted
SDL2/i686-w64-mingw32/include
folder, copy the SDL2 folder to your project/include (so that inside your project you will have include/SDL2). - From
SDL2/i686-w64-mingw32/bin
folder, copy SDL2.dll to your project root. - From
SDL2/i686-w64-mingw32/lib
folder, copy libSDL2main.a to your project root.
In your project root, create main.cpp with this code:
- Download SFML source code from https://www.sfml-dev.org/download.php
- Download CMake from https://cmake.org/download/
- Open CMake GUI.
- Enter source code path to CMake (C:/libs/src/SFML-2.5.1).
- Enter build path to CMake (C:/libs/src/SFML-2.5.1/build).
- Press Configure and select
MinGW Makefiles
andUse default native compilers
. - Now you have SFML-2.5.1/build folder and makefile in there, open terminal inside the new build folder and type:
mingw32-make
.
- Download SFML for Mac from: https://www.sfml-dev.org/download.php
- From extracted folder, copy contents of
Frameworks
andextlibs
folders to/Library/Frameworks
. - From extracted folder, copy
templates
folder to~/Library/Developer/Xcode/Templates
. - Create new project with SFML template and select using of Frameworks instead of dynamic libraries.
- If building fails, go to
Build phases
and select For install builds only.
sudo apt install python3-pip --fix-missing
pip3 install virtualenv
nano ~/.profile
and add the location to path, copy paste this kind of line in the end of the file:PATH="$PATH:/home/mikal/.local/bin"
or wherever it is located. After installation, virtualenv lets you know the location.- Now you can create virtual environment using
virtualenv venv
- Activate your environment using
source venv/bin/activate
and you will see (venv) appearing in front of your command prompt.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import json | |
# Define class. | |
class Todo: | |
# Define constructor function with parameters. | |
def __init__(self, id, description): | |
# Assign parameters. | |
self.id = id | |
self.description = description |