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(obj) { | |
'use strict'; | |
/* | |
* @name: isURL | |
* @description: Checks if a String is an URI | |
* | |
* @param String : The string to be checked | |
*/ |
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 createObservable(observable, { onGet, onSet }) { | |
const interceptor = { | |
get(target, key, receiver) { | |
onGet(key) | |
return target[key] | |
}, | |
set(target, prop, value) { | |
onSet(prop, value) | |
return true | |
} |
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 simpleFp() { | |
const Utils = { | |
getFunctionArity(fn) { | |
return fn.length | |
}, | |
getFunctionModule(fnName, fnArity) { | |
const fnPath = fnName.split('.') | |
const isOuter = fnPath.length > 1 | |
if (isOuter) { |
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
defmodule('Contestation', ({ def, run, callbacks }) => { | |
const { Http } = Defy.Plugins | |
const storageURL = `${process.env.SANDFILE_URL}/document` | |
const graphQLURL = process.env.GRAPHQL_URL | |
def('post_document', doc => { | |
const requestPayload = { | |
query: mutationBuilder(doc, 'addDocument', 'errors { code path description } }') | |
} |
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
/* | |
Fat Cursor. | |
This overwrites the "underline thin" style since that is one that can be styled with CSS | |
So set your settings to: | |
"editor.cursorStyle": "underline-thin", | |
*/ | |
.monaco-editor .cursors-layer.cursor-underline-thin-style > .cursor { | |
border-bottom-width: 0; | |
border-left-width: 3px; | |
border-left-style: solid; |
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 Fetch = (fun, fetcher) => fun({ | |
get(endpoint, headers) { | |
return fetch(endpoint, headers) | |
}, | |
post(endpoint, body, headers) { | |
return fetch(endpoint, { body, headers, method: 'POST' }) | |
} | |
}) | |
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
// Setting dynamic CORS for non-options Request | |
app.use(cors((req, cb) => { | |
const companyDNS = '.mycompany.xyz' | |
const isTrusted = req.header('Origin').indexOf(companyDNS) >= 1 | |
// Some more business logics... | |
return cb(null, { | |
credentials: true, | |
origin: isTrusted |
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
+ app.use('/', cors...) | |
- app.use(cors...) |
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 { Button } from './Button' | |
export const Dialog = props => h('article', { | |
id: 'my-dialog', | |
content: Button({ | |
textContent: 'Hey', | |
onclick: props.onSuccessClick | |
}) | |
}) |
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 createElement = name => | |
document.createElement(String(name).toUpperCase()) | |
const defineAttributes = (VNode, attributes) => | |
Object.keys(attributes).forEach(attr => | |
VNode.setAttribute(attr, attributes[attr])) | |
const defineChildren = (VNode, children) => | |
Array.isArray(children) && children.forEach(e => VNode.appendChild(e)) |
OlderNewer