Skip to content

Instantly share code, notes, and snippets.

View vasergen's full-sized avatar

Vasyl Gendzeliuk vasergen

  • Hamburg, Germany
View GitHub Profile
(function() {
let chatModule = (function() {
let message = 'hi bro'
function say() {
console.log(message);
}
return {
say: say
let observerDecorator = (function () {
let eventList = {}
return function (obj) {
obj.addEvent = (event, fn) => {
if(!eventList[event]) {
eventList[event] = []
}
if(eventList[event].indexOf(fn) === -1) {
//Function composition
function Animal(name) {
let publicAPI = {
say: function() {
console.log(`I am ${name}`);
}
}
return publicAPI
}
//Prototype Pattern
function Animal(name) {
this.name = name
}
Animal.prototype.say = function() {
console.log(`I am ${this.name}`)
}
function Rabbit(name) {
//Function inheritance
function Animal(name) {
this.name = name
this.say = function() {
console.log(`I am ${this.name}`)
}
}
function Rabbit(name) {
//OLOO - delegated objects
var Animal = {
init: function(name) {
this.name = name
},
say: function() {
console.log(`I am ${this.name}`)
}
}
@vasergen
vasergen / gist:37d5446a8acec67d1e1fa2138635bc84
Created September 15, 2016 07:55 — forked from totherik/gist:3a4432f26eea1224ceeb
v8 --allow-natives-syntax RuntimeFunctions
Per https://code.google.com/p/v8/codesearch#v8/trunk/src/runtime.cc
%CreateSymbol
%CreatePrivateSymbol
%CreateGlobalPrivateSymbol
%NewSymbolWrapper
%SymbolDescription
%SymbolRegistry
%SymbolIsPrivate
@vasergen
vasergen / .npmrc
Created September 19, 2016 19:15 — forked from kentcdodds/.npmrc
save-exact=true
@vasergen
vasergen / google_text2speech.md
Created September 20, 2016 13:53 — forked from alotaiba/google_text2speech.md
Google Text to Speech API

Google Text to Speech API

Base URL: http://translate.google.com/translate_tts
It converts written words into audio. It accepts GET requests.

GET

q
The query string to convert to audio

tl
Translation language, for example, ar for Arabic, or en-us for English