Skip to content

Instantly share code, notes, and snippets.

View shashankduhan's full-sized avatar
🐷
On it, for quite a long time.

Shashank Duhan shashankduhan

🐷
On it, for quite a long time.
  • India
View GitHub Profile
@shashankduhan
shashankduhan / router.js
Created January 2, 2017 01:22
A simple Hash Router for javascript
//Shashank Duhan 2017 | CC.0
//You gonna need reflex.js for this :
// https://gist.github.com/shashankduhan/673a4e1223afe550ca69958bcb73181c
window.router = (()=>{
"use strict"
return {
state: 0,
init: function(user){
router.routes = router.state;
window.addEventListener("hashchange", router.router);
@shashankduhan
shashankduhan / lclib.js
Last active January 25, 2017 02:59
A small but effective library with day to day life commands made easy.
window.load = (function(){
"use strict";
//This is sample module for loading a module using require() function in webpack.
//Simply put load.init(); in window.onload callback.
return {
init: function(){
//*************************************
//Initialize some global functions..
//If you want to load a library, write codes in here.
@shashankduhan
shashankduhan / reflex.js
Last active January 31, 2017 09:29
Reflex - A simple application architecture to handle complex events.
//Our finite state machine
window.reflexes = (()=>{
"use strict"
return {
dispatcher: e =>
{
//Add some suffix to our packet before dispatching
window.router = window.router ? window.router : {state: "yo"};
e.origin = !window.router.state ? "alien_request" : window.router.state;
e.hash = window.router.routes;
<div><span>Project</span> WAVES</div>
var mymodule = (function(){
"use strict";
//This is sample module for loading a module using require() function in webpack.
return {
init: function(){
//*************************************
//Initialize some global functions..
//If you want to load a library, write codes in here.
@shashankduhan
shashankduhan / README.md
Created October 30, 2012 04:16
Readme - Test

This is a test project to learn GIT Behaviour