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 validateAndCall(args, enforcedFunction, maxArgumentCount) { | |
if(args.length > maxCount) { | |
throw new Error(`Function '${fn.name}' cannot be called with more than ${maxCount} arguments, but was called with ${args.length}`); | |
} | |
return fn.apply(null, args); | |
} | |
function enforceCount({ enforcedFunction, maxArgumentCount }) { | |
return 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
from ...Interfaces.LoggerInterface import LoggerInterface | |
class DataAccess: | |
def __init__(self, logger=LoggerInterface): # connection_string_factory | |
self.logger = logger | |
def query(self, user_data): | |
self.validate_request(user_data) | |
self.logger.log(f"User provided input: {user_data}") |
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
<!-- https://developer.mozilla.org/en-US/docs/Web/API/Element/innerHTML --> | |
<div id="container"> | |
<p>This is some text</p> | |
</div> | |
<script> | |
// innerHTML retrieves all HTML content inside of a selected element | |
// and returns it as a string |
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
begin | |
# To Do List | |
let tasks be (newArray:) | |
declare function addATask | |
let newTask be prompt: "What do you want to do?" | |
appendTo: tasks newTask | |
call startToDoList |
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
// If you want to convert a PascalCase variable to camelCase, you can do the following: | |
// Where `n` is the tab stop you want to reference | |
${n/^(.)(.*)$/${1:/downcase}${2}/} | |
// Example: ${1:This is my original} => ${1/^(.)(.*)$/${1:/downcase}${2}/} | |
// If you want to convert a camelCase variable to PascalCase, you can do the following: | |
// Where `n` is the tab stop you want to reference | |
${n/^(.)(.*)$/${1:/upcase}${2}/} |
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
'use strict'; | |
const fs = require('fs'); | |
const xml2js = require('xml2js'); | |
const moment = require('moment'); | |
const importConfig = require('./postImporterConfig.json'); | |
const { xmlPath, oldDomain, newDomain, wpContentLocation } = importConfig; | |
const postXML = fs.readFileSync(xmlPath, { encoding: 'utf8' }); |
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
promiseReturningService | |
.getUserData() | |
.then((userData) => { | |
// this only runs if there is no error getting user data | |
return userData.userName; | |
}) | |
.then((userName) => { | |
// this only runs if there is no error in all previous calls | |
console.log(userName); | |
}) |
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 logo from './logo.svg'; | |
import './App.css'; | |
function AppFactory(React) { | |
const { Component } = React; | |
class App extends Component { | |
render() { | |
return ( |
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 async saveDataOrDefault(todoId, messageRecord) { | |
if(messageRecord !== null) { | |
await dbModel.saveData(todoId, messageRecord); | |
} else { | |
await dbModel.saveData(todoId, { message: null }); | |
} | |
} |
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
'use strict'; | |
const assert = require('chai').assert; | |
const sinon = require('sinon'); | |
const container = require('../example-container'); | |
describe('file reader', function () { | |
let fileReader; | |
let logSpy; | |
NewerOlder