Skip to content

Instantly share code, notes, and snippets.

View Pan-Maciek's full-sized avatar
🤫

Maciej Kozieja Pan-Maciek

🤫
  • Qualtrics
  • Kraków
View GitHub Profile
var fs = require("fs"); // const
var qs = require("querystring"); // const
console.log("Start API"); // unikaj console.logów w API tego będą używac ludzie i na tej zadzadnie tworzyć interfejsy ty im niczego nie narzucaj tylko ważne informacje typu błędy mogą być wyświetlane
// proponował bym żeby moduł zwracał funkcje tworzącą serwer albo odrazu utworzony serwer coś jak express
module.exports = function (req, res) {
return {
res: res, // mozna zapisac wtedy tylko res
req: req, // req: req ==== req nie trzeba tyle pisać
ViewLang: function (static, page) { // mozna zapisac poprostu ViewLang(static, page)
var data = fs.readdir(static, function (err, files) { // może fat arrow ? (err, files) => {}
@Pan-Maciek
Pan-Maciek / Vector2.js
Created February 19, 2017 13:31
Rzutowanie 3d na 2d (rzut izometryczny)
/** Class representing a 2D vector. (X, Y)*/
export default class Vector2 {
constructor(X = 0, Y = 0) {
this.X = X
this.Y = Y
}
/** Returns new Vector2 rotated by given angle (in radians) and any point.
* @param {Number} rad Angle of rotation given in radians.
* @param {Vector2} vector2 Point against which rotation is performed.
/** Celem funkcji addLanding jest dodanie klas(y) w momęcie gdy obiekt staje się widzialny na stronie.
* @param {String} selector Selektor elementów.
* @param {String|Array<String>} className Klasa lub klasy które mają być dodane gdy element staje się widoczny.
* @param {Number=} offset Ile pikseli elementu musi być widoczne, domyślnie 20.
* @returns {void}
*/
const addLanding = (selector, className, offset = 20) => {
if (!selector) throw "Podaj selektor w innym wypadku używanie tej funkcji nei ma sensu."
if (!className) throw "Podaj nazwę klasy w innym wypadku używanie tej funkcji nei ma sensu."
const found = document.querySelectorAll(selector)
[{
"ID": 1,
"Country": "Italy",
"Animals": [{
"species": "dog",
"name": "Bailey",
"age": "5"
}, {
"species": "dog",
"name": "Charlie",
/*! easyCookies v1.1.0 | (c) Maciej Kozieja | https://github.com/koziejka/easyCookies */
const cookie=new Proxy({},{get(a,b){const c=RegExp(`${b}=(.*?);`).exec(document.cookie+";");return null==c?null:JSON.parse(decodeURIComponent(c[1]))},set(a,b,c){let d="";c.isCookie&&(c.expires&&(d+=`expires=${c.expires};`),c.path&&(d+=`path=${c.path};`),c=c.value),"object"==typeof c?c=JSON.stringify(c):"string"==typeof c&&(c=`"${c}"`),document.cookie=`${b}=${encodeURIComponent(c)};${d}`},deleteProperty(a,b){document.cookie=`${b}=;expires=Thu, 01 Jan 1970 00:00:01 GMT;`}});Object.defineProperty(window,"cookies",{get(){const a={},b=RegExp(/(\w)+=(.*?);/g),c=document.cookie+";";let d;for(;d=b.exec(c);)a[d[1]]=JSON.parse(decodeURIComponent(d[2]));return a}});class Cookie{constructor(value,expires,path){this.value=value||value;if(expires){if(typeof expires=="string")this.expires=expires;else this.expires=expires.toUTCString()}if(path)this.path=path;this.isCookie=true}}
using System;
using System.Data;
using System.Windows.Forms;
namespace Calculator {
public partial class Calculator : Form {
public Calculator() {
InitializeComponent();
KeyPreview = true;
@Pan-Maciek
Pan-Maciek / Vector2.js
Created February 8, 2017 15:18
Rotating 2D vector.
/** Class representing a 2D vector. (X, Y)*/
export default class Vector2 {
constructor(X = 0, Y = 0) {
this.X = X
this.Y = Y
}
/** Returns new Vector2 rotated by given angle (in radians) and any point.
* @param {Number} rad Angle of rotation given in radians.
* @param {Vector2} vector2 Point against which rotation is performed.
* @returns {Vector2}
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <math.h>
int qpow(int base, int p){
if (p == 0) return 1;
int value = base;
for (; p > 1; --p) value *= base;
return value;
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <math.h>
int qpow(int base, int p){
if (p == 0) return 1;
int value = base;
for (; p > 1; --p) value *= base;
return value;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace macierze
{
// Uwagi ogólne