Skip to content

Instantly share code, notes, and snippets.

View Frodigo's full-sized avatar

Marcin Kwiatkowski Frodigo

View GitHub Profile
@Frodigo
Frodigo / index.html
Created October 6, 2015 19:53 — forked from anonymous/index.html
JS Bin // source http://jsbin.com/qigube
<!DOCTYPE html>
<html>
<head>
<script src="https://code.jquery.com/jquery-1.9.1.js"></script>
<meta charset="utf-8">
<title>JS Bin</title>
</head>
<body>
<div class="input-wrap">
<label><input type="checkbox" data-check="all">all</label>
@Frodigo
Frodigo / jsbin.xatuvo.js
Last active October 8, 2015 18:13 — forked from anonymous/index.html
JS Bin// source http://jsbin.com/xatuvo
// dziedziczenie
var Person = function(name) {
this.name = name;
};
Person.prototype.sayHello = function() {
console.log('Cześć jestem ' + this.name);
};
@Frodigo
Frodigo / inheritance.js
Created May 9, 2016 09:27
JavaScript inheritance (borrowing and setting prototype)
(function() {
Parent.prototype.say = say;
Child.prototype = new Parent();
function Parent (name) {
this.name = name || 'Paul';
}
function say () {
@Frodigo
Frodigo / inherit.js
Last active May 9, 2016 10:07
JavaScript inheritance ( temporary constructor)
function inherit(C, P) {
var F = function () {};
F.prototype = P.prototype;
C.prototype = new F();
C.uber = P.prototype;
C.prototype.constructor = C;
}
@Frodigo
Frodigo / singleton.js
Created May 9, 2016 10:29
JavaScript Singleton design pattern implementation
var Singleton = (function () {
'use strict';
var instance;
function createInstance() {
return{
data: 'some data'
};
}
@Frodigo
Frodigo / factory.js
Created May 9, 2016 10:46
JavaScript factory design pattern implementation
(function() {
'use strict';
function CarMaker() {}
CarMaker.prototype.drive = function () {
console.log('This car have ' + this.doors + ' doors');
};
CarMaker.factory = function (type) {
@Frodigo
Frodigo / iterator.js
Created May 9, 2016 11:18
JavaScript iteator design patterns implementation
(function() {
'use strict';
var agg = (function () {
var index = 0,
data = [1, 2, 3, 4, 5],
length = data.length;
return {
next: function () {
@Frodigo
Frodigo / decorator.js
Created May 9, 2016 11:41
JavaScript decorator design pattern implementation
(function() {
'use strict';
function Sale(price) {
this.price = price || 100;
this.decorators_list = [];
}
Sale.decorators = {};
@Frodigo
Frodigo / strategy-validator.j
Created May 9, 2016 12:06
JavaScript strategy design pattern implementation
(function() {
'use strict';
var validator = {
types: {},
messages: [],
config: {},
validate: function (data) {
var i, msg, type, checker, result_ok;
this.messages = [];
@Frodigo
Frodigo / creating-pwa-studio-instance
Last active November 5, 2020 11:51
Creating PWA Studio instance
$ yarn create @magento/pwa