This file contains 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 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 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 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 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 - antonio.c.capelo@gmail.com" | |
# 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 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 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 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 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
const useWindowSize = () => { | |
const [dimensions, setDimension] = useState({ | |
width: window.innerWidth, | |
height: window.innerHeight, | |
}); | |
useEffect(() => { | |
const handler = () => { | |
const {innerWidth, innerHeight} = window; | |
setDimension({ width: innerWidth, height: innerHeight}) |
This file contains 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
import React from 'react'; | |
import { styled } from '@material-ui/styles'; | |
import AppBar from '@material-ui/core/AppBar'; | |
type CustomProps = { show: boolean }; | |
// Let's imagine MyComponent is a special type of button... | |
type MyComponentProps = CustomProps & React.HTMLProps<HTMLButtonElement>; | |
const MyComponent = ({show, ...rest}: MyComponentProps) => { |