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
const saveImgTemp = function (req, res, next) { | |
const writeStream = fs.createWriteStream( | |
path.join(__dirname, "../store/test.png") | |
); | |
req.pipe(writeStream); | |
// After all the data is saved, respond with a simple html form so they can post more data | |
req.on('end', function () { | |
res.send({msg: "Works"}) | |
}); |
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
handleDropToList(oEvent) { | |
// Define if item is dropped on, before or after elements in new drop-list | |
// let sDropPosition = oEvent.getParameter("dropPosition"); | |
// Define the list which is dragged from, and the handled Item | |
let oDraggedControl = oEvent.getParameter("draggedControl"); | |
let oDraggedItems = oDraggedControl.mBindingInfos.items; | |
let oDraggedPath; |
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
/** | |
* Helper function to encrypt a JSON or Javascript Object | |
* | |
*/ | |
const crypto = require("crypto"); | |
const jEncrypt = (pubKey, obj, callback) => { | |
const algorithm = "aes-192-cbc"; |
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
/* | |
* The node process | |
* It's a global object that, itself as well as its methods | |
* and nested objects, can be accessed from anywhere anytime. | |
* Within the process, global variables can be defined. A prominent | |
* example is the node.env.NODE_ENV variable. It is a convention to, | |
* for instance, set the process.env.NODE_ENV to production. | |
*/ | |
console.log(process); | |
console.log(process.memoryUsage()); |
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
Show hidden characters
{ | |
// Place your snippets for javascript here. Each snippet is defined under a snippet name and has a prefix, body and | |
// description. The prefix is what is used to trigger the snippet and the body will be expanded and inserted. Possible variables are: | |
// $1, $2 for tab stops, $0 for the final cursor position, and ${1:label}, ${2:another} for placeholders. Placeholders with the | |
// same ids are connected. | |
// Example: | |
// "Print to console": { | |
// "prefix": "log", | |
// "body": [ | |
// "console.log('$1');", |
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
<template> | |
<div class="form-group mb-4"> | |
<label class="text-bold">{{label}}</label> | |
<textarea @keyup="emitValue" v-model="text" class="form-input" :id="id" :placeholder="placeholder" :name="name" rows="2" /> | |
<small style="float: right;" v-if="wordcount && textValue.words > 1">Count: {{textValue.words}} words</small> | |
</div> | |
</template> | |
<script> | |
/* |
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
<template> | |
<div class="container" id="app"> | |
<div class="row"> | |
<div class="col"> | |
<h1>Filters & Mixins</h1> | |
<!-- Local filter which reverses the text that is applied --> | |
<input type="text" class="form-control" v-model="text"/> | |
<p>{{text|reverseText}}</p> | |
<!-- Build a global filter that counts the length of a word + appends it --> |
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
const Recipe = require("../models/recipe"); | |
const path = require("path"); | |
const fs = require("fs"); | |
const galleryPath = require("../config/paths").galleryPath; | |
const date = new Date(); | |
// Find the recipe by the given ID and delete it from the database. | |
const deleteRecipe = function (req, res) { | |
Recipe.findByIdAndDelete(req.body.recipe_id, (err, data) => { |
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
class D { | |
// Initialize the constructor. An object is passed that specifies the DOM element to be created | |
constructor( | |
props = { | |
el: "" /* Type of the DOM element */, | |
cl: [] /* Class list */, | |
id: "", | |
src: "" /* This is also considered as the href for css elements */, | |
href: "", /* Adds a ref for anchor elements or buttons [not to be confused with src] */ | |
name: "" /* Adds a name to the element */, |
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
// Check for color darkness. Returns false of dark'ish, true if bright | |
function checkForBrightness(arr) { | |
let sortedArr = arr.sort; | |
return (sortedArr[0] < 150 && sortedArr[1] < 80 && sortedArr[2] < 80) ? | |
false : true | |
} |
NewerOlder