Skip to content

Instantly share code, notes, and snippets.

View hwclass's full-sized avatar

Barış Güler hwclass

View GitHub Profile
@hwclass
hwclass / base.html
Last active January 1, 2016 19:59
Page by Page Namespace with IIFE Code Structure
<!DOCTYPE html>
<html lang="tr" class="no-js">
<head>
<link rel="canonical"/>
<title>Project Name</title>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="description" content="test"/>
<meta name="keywords" content="test"/>
<meta property="fb:app_id" content="229179347121022"/>
stop: function() {
var behaviorInstance, moduleBehaviors;
if (!Array.isArray(arguments)) {
var element = arguments;
var instanceData = getInstanceDataByElement(element);
if (!instanceData) {
@hwclass
hwclass / Module.js
Last active March 1, 2016 23:06
Design Patterns : Module Pattern
/**
* @fileoverview The base object to generate modules
* @author hwclass
*/
/**
* models/Module.js
* This object is used to generate some instances
* as modules to be attached into the MODULES array.
*/
@hwclass
hwclass / ajax.js
Created July 2, 2015 09:24
Design Patterns : Publish / Subscribe Pattern
/**
* @fileoverview The sample js file that are thought that publishes the coming data from an API endpoint
* @author hwclass
*/
/**
* ajax.js
* This file contains a publish command for productsFetchedEvent
*/
@hwclass
hwclass / MessageStore.js
Last active March 17, 2016 09:54
Mixin Builder : An example using compositional inheritance to create new functionalities by mixin curations.
var MessageStore = (function MessageStore () {
return {
HOLDING_THE_WHELL : 'holding whell...',
FIRING_THE_ENGINE : 'firing the engine...',
FULLING_THE_TANK : 'fulling the tank...',
HOLDING_THE_STICK : 'holding the stick'
}
})();
//Composition builder wrapper
const Builder = (() => {
compose = (obj, props) => {
return Object.assign(obj, props)
}
return {
compose: compose
}
})();
class DummyEventEmitter {
//it is added to make the publishing feel like an emit
//event in EventEmitter library.
emit(eventName, callback) {
alert(eventName, callback);
}
}
class CounterStore extends DummyEventEmitter {
(function () {
return {
URLS: {
ICONS: '...'
},
MESSAGES: {
FILL_IN_THE_BLANKS: 'Please, fill in the blanks.'
}
}
}());
var reducer = (() => {
var ABSOLUTE_STATE = {};
return {
get: (actionAlias) => {
return ABSOLUTE_STATE[actionAlias];
},
@hwclass
hwclass / formulas.fs
Created January 23, 2017 23:51
F Sharp Notes
xyz = "xyz";;
 Stopped due to error
 System.Exception: Operation could not be completed due to earlier error
 The value or constructor 'xyz' is not defined at 2,0
let xyz = "xyz";;
 val xyz : string = "xyz"
"abc";;
 val it : string = "abc"