Skip to content

Instantly share code, notes, and snippets.

View rangoo94's full-sized avatar
👾

Dawid Rusnak rangoo94

👾
View GitHub Profile
@rangoo94
rangoo94 / User.js
Created December 1, 2017 20:56
Private properties in JS
import addPrivacy from './addPrivacy'
class User {
constructor (username, password) {
this.username = username
this.password = password
}
login () {
console.log('Trying to log in with username: %s, password: %s', this.username, this.password)
@rangoo94
rangoo94 / info.md
Last active February 24, 2017 22:30
Benchmark Node.js versions (http.createServer vs net.createServer vs express.js)

Benchmark different Node.js versions

Benchmark was done using siege. I made it to see how big abstraction is in http & express according to base layer of net.

How it was run

  • nvm use X
  • node http.js &
  • siege -r 500 -c 200 -b http://localhost:3001/
@rangoo94
rangoo94 / scroll.js
Created January 28, 2015 15:10
Smooth scroll
function currentYPosition() {
// Firefox, Chrome, Opera, Safari
if (self.pageYOffset) return self.pageYOffset;
// Internet Explorer 6 - standards mode
if (document.documentElement && document.documentElement.scrollTop)
return document.documentElement.scrollTop;
// Internet Explorer 6, 7 and 8
if (document.body.scrollTop) return document.body.scrollTop;