Skip to content

Instantly share code, notes, and snippets.

View SteelPh0enix's full-sized avatar
🅱️
yeet

Wojciech Olech SteelPh0enix

🅱️
yeet
View GitHub Profile
@SteelPh0enix
SteelPh0enix / click.ino
Last active November 11, 2016 11:35
arduino click - light
int ledPin = 13;
int buttonPin = 9;
bool ledState = false; //false - wyłączona, true - włączona
void setup() {
pinMode(ledPin, OUTPUT);
pinMode(buttonPin, INPUT);
}
void loop() {
#include <iostream>
//przykład funkcji z i bez referencji
//dwie poniższe funkcje robią dokładnie to samo, tylko jedna używa referencji a druga nie
void referencja(int &a) {
a *= a;
}
int nieReferencja(int a) {
return a*a;
#include <iostream>
#include <array>
int main() {
std::array<int, 10> a{1, 2, 4, 8, 16, 32, 64, 128, 256, 512};
auto iter = a.begin();
for(int i = 0; i < 10; ++i)
std::cout << *iter++ << std::endl;
return 0;
}
#ifndef __SFML_DRAWABLES_HPP__
#define __SFML_DRAWABLES_HPP__
#include <iostream>
#include <SFML/Graphics.hpp>
class Something : public sf::Drawable { //direct inheritance from sf::Drawable (Something -> sf::Drawable)
private:
sf::RectangleShape somethingShape;
virtual void draw(sf::RenderTarget& target, sf::RenderStates states) const {
// Credits to Vesim987
// - no structures
// - no headers
// - maximum 2 called functions
// - one declared function
// - no defined functions
// - mindfuck
//monster:
#define DWORD unsigned long
@SteelPh0enix
SteelPh0enix / button.cpp
Last active June 25, 2017 12:34
added hover check in checkEvent
#include "button.hpp"
Button::Button(const sf::Vector2f& position,
const sf::Vector2f& size,
const sf::String& text,
const sf::Font& font,
const unsigned int textSize)
: isHovering(false) {
// ustawienie początkowych wartości
buttonBody.setPosition(position);
#include <iostream>
int main() {
std::cout << "Hello, world!" << std::endl;
return 0;
}
#include <iostream>
int main() {
int variable;
std::cout << variable << std::endl;
variable = 12;
std::cout << variable << std::endl;
return 0;
@SteelPh0enix
SteelPh0enix / mathematical_operations.cpp
Last active July 12, 2017 07:23
proper variable initialiser-list initialisation
#include <iostream>
int main() {
//operacja dodawania
int sum {2 + 2};
//operacja mnożenia
int multiplication {3 * 4};
//dzielenie z użyciem operatora przypisania
@SteelPh0enix
SteelPh0enix / power.cpp
Last active July 12, 2017 07:24
fixed - proper initialisation
#include <cmath>
#include <iostream>
int main() {
double power {std::pow(2., 3.)};
std::cout << "2 to the power of 3: " << power << std::endl;
return 0;
}