This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function( global ) { | |
var ModPattern = function() { | |
function api1 (argument) { | |
return this.publicInstanceValue++; | |
} | |
function api2 (argument) { | |
return privateInstanceValue++; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function BaseClass () { | |
this.doSomething = function () { | |
}; | |
} | |
BaseClass.prototype.someObject = {}; | |
BaseClass.prototype.sharedSomething = function () { | |
}; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// view engine setup - erased | |
// app.set('views', path.join(__dirname, 'views')); | |
// app.set('view engine', 'jade'); | |
app.use(favicon(path.join(__dirname,'dist','favicon.ico'))); | |
app.use(logger('dev')); | |
app.use(bodyParser.json()); | |
app.use(bodyParser.urlencoded()); | |
app.use(cookieParser()); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function (exports) { | |
function urlsToAbsolute(nodeList) { | |
if (!nodeList.length) { | |
return []; | |
} | |
var attrName = 'href'; | |
if (nodeList[0].__proto__ === HTMLImageElement.prototype | |
|| nodeList[0].__proto__ === HTMLScriptElement.prototype) { | |
attrName = 'src'; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
description "task for nodeJS powered site" | |
author "António Capelo - [email protected]" | |
# used to be: start on startup | |
# until we found some mounts weren't ready yet while booting: | |
start on started mountall | |
stop on shutdown | |
# Automatically Respawn: | |
respawn |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
app.factory('BearerAuthInterceptor', function ($window, $q) { | |
return { | |
request: function(config) { | |
config.headers = config.headers || {}; | |
if ($window.localStorage.getItem('token')) { | |
// may also use sessionStorage | |
config.headers.Authorization = 'Bearer ' + $window.localStorage.getItem('token'); | |
} | |
return config || $q.when(config); | |
}, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function getParamsObj(url) { | |
return url | |
.split('?')[1] | |
.split('&') | |
.map(function(el) { | |
return el.split('='); | |
}) | |
.reduce(function(prevVal, currVal) { | |
prevVal[currVal[0]] = currVal[1] | |
.split(',') |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
body { | |
padding: 10px; | |
background: url('https://i.ytimg.com/vi/09nTwccQTUA/maxresdefault.jpg'); | |
background-size: cover; | |
font-size: 25px; | |
margin: 0 auto; | |
width: 100px; | |
background-position: center; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
:set backupcopy=yes |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* useScrollListener hook | |
* Usage: const { scrollY, scrollDirection } = useScrollListener(); | |
*/ | |
import { useState, useRef, useEffect } from 'react'; | |
export function useScroll() { | |
const [scrollY, setScrollY] = useState(0); | |
const [progress, setProgress] = useState(0); |