Skip to content

Instantly share code, notes, and snippets.

@kj786
kj786 / gist:b6a96ea795befb98fb3b
Last active August 29, 2015 14:12
HTML: Starting HTML
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Document</title>
</head>
<body>
<h1>Hello World, this is a test</h1>
</body>
</html>
@kj786
kj786 / gist:1779151fd7a25940754b
Created January 5, 2015 04:13
CSS: Image Replacement
.ir {
border: 0;
font: 0/0 a;
text-shadow: none;
color: transparent;
background-color: transparent;
}
@kj786
kj786 / gist:4cd4a2aeeb1732faff06
Last active August 29, 2015 14:12 — forked from padolsey/gist:527683
Javascript: IE Detection
// ----------------------------------------------------------
// A short snippet for detecting versions of IE in JavaScript
// without resorting to user-agent sniffing
// ----------------------------------------------------------
// If you're not in IE (or IE version is less than 5) then:
// ie === undefined
// If you're in IE (>=5) then you can determine which version:
// ie === 7; // IE7
// Thus, to detect IE:
// if (ie) {}
@kj786
kj786 / String objects
Last active August 29, 2015 14:17
What is practical difference between String(...) and new String(...)
I failed to properly understand the way String(..) works in following portion:
return new TextCell(String(row[name]));
from http://eloquentjavascript.net/06_object.html
The answer is below https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String:
Distinction between string primitives and String objects
Note that JavaScript distinguishes between String objects and primitive string values. (The same is true of Boolean and Numbers.)
@kj786
kj786 / vector.js
Last active January 23, 2018 03:30
Implement getters and setters to ease access to private members of Vector.
/*global console: true */
"use strict";
/*
A vector type
Write a constructor Vector that represents a vector in two-dimensional
space. It takes x and y parameters (numbers), which it should save to
properties of the same name.
Give the Vector prototype two methods, plus and minus, that take another vector as a parameter and return a new vector that has the sum
or difference of the two vectors’ (the one in this and the parameter) x
and y values.
@kj786
kj786 / general js-settings.js
Created March 16, 2015 16:28
general JS-settings
/*global console: true */
/*jshint quotmark: false */
"use strict";
console.log();
@kj786
kj786 / .jscs.json
Created March 16, 2015 18:55
JSCS Styleguide validation according to Google
{
"requireCurlyBraces": [
"if",
"else",
"for",
"while",
"do",
"try",
"catch"
],