Skip to content

Instantly share code, notes, and snippets.

View KrystianP's full-sized avatar

Krystian P KrystianP

View GitHub Profile
@KrystianP
KrystianP / blank html
Created March 24, 2014 16:38
blank html
<!doctype html>
<html>
<head>
<title>A blank HTML5 page</title>
<meta charset="utf-8" />
</head>
<body>
</body>
@KrystianP
KrystianP / JS :: Extend Prototype Array.js
Last active December 20, 2015 04:19
Extend Prototype Array
if(!Array.prototype.inArray){
Array.prototype.inArray = function (elem){
for(i=0, j = this.length; i < j; i++){
if(this[i] == elem) return true;
}
return false;
} // end Array.prototype.inArray
}
@KrystianP
KrystianP / JS: cloneObject
Last active April 26, 2024 04:39
Clone obj in js
function clone(obj) {
if (null == obj || "object" != typeof obj) return obj;
var copy = new obj.constructor();
for (var attr in obj) {
if (obj.hasOwnProperty(attr)) copy[attr] = obj[attr];
}
return copy;
}
@KrystianP
KrystianP / JS: basic_js.js
Last active December 20, 2015 02:09
basic js function
var per = function(imie, naziwsko){
var person = {};
Object.defineProperties(person, {
imie : {
value: imie,
},
naziwsko : {
value: naziwsko ,
writable: true,
//detect Internet Explorer and version number through injected conditional comments (no UA detect, no need for cond. compilation / jscript check)
//version arg is for IE version (optional)
//comparison arg supports 'lte', 'gte', etc (optional)
var isIE = (function(undefined){
var doc = document,
doc_elem = doc.documentElement,
cache = {},