using mocha/chai/sinon for node.js unit-tests? check out my utility: mocha-stirrer to easily reuse test components and mock require dependencies
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 axios from "axios"; | |
export default async function () { | |
const { data: { id } } = await axios.get("//localhost:3000/id"); | |
const { data: { group } } = await axios.get("//localhost:3000/group"); | |
const { data: { name } } = await axios.get(`//localhost:3000/${group}/${id}`); | |
console.log(name); // Michał | |
} |
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 str = 'i love codewars' | |
// s rawe docevoli | |
function reverse (str) { | |
let res = '' | |
const spaces = []; | |
Array.from(str).forEach((item, index) => { | |
if (item === ' ') { | |
spaces.push(index) | |
} |
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
the best way (I've found) to completely uninstall node + npm is to do the following: | |
go to /usr/local/lib and delete any node and node_modules | |
go to /usr/local/include and delete any node and node_modules directory | |
if you installed with brew install node, then run brew uninstall node in your terminal | |
check your Home directory for any local or lib or include folders, and delete any node or node_modules from there | |
go to /usr/local/bin and delete any node executable | |
You may need to do the additional instructions as well: | |
sudo rm /usr/local/bin/npm |
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
Sub SelectActualUsedRange() | |
Dim FirstCell As Range, LastCell As Range | |
Set LastCell = Cells(Cells.Find(What:="*", SearchOrder:=xlRows, _ | |
SearchDirection:=xlPrevious, LookIn:=xlValues).row, _ | |
Cells.Find(What:="*", SearchOrder:=xlByColumns, _ | |
SearchDirection:=xlPrevious, LookIn:=xlValues).Column) | |
Set FirstCell = Cells(Cells.Find(What:="*", After:=LastCell, SearchOrder:=xlRows, _ | |
SearchDirection:=xlNext, LookIn:=xlValues).row, _ | |
Cells.Find(What:="*", After:=LastCell, SearchOrder:=xlByColumns, _ | |
SearchDirection:=xlNext, LookIn:=xlValues).Column) |
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 '../scss/index.scss'; |
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
var ObjectId = require('mongoose').Types.ObjectId; | |
var objId = new ObjectId( (param.length < 12) ? "123456789012" : param ); | |
// You should make string 'param' as ObjectId type. To avoid exception, | |
// the 'param' must consist of more than 12 characters. | |
User.find( { $or:[ {'_id':objId}, {'name':param}, {'nickname':param} ]}, | |
function(err,docs){ | |
if(!err) res.send(docs); | |
}); |
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
.select2-container .select2-choice { | |
border: 2px solid #dce4ec; | |
font-family: "Lato", sans-serif; | |
font-size: 14px; | |
text-indent: 1px; | |
-webkit-border-radius: 6px; | |
-moz-border-radius: 6px; | |
border-radius: 6px; | |
-webkit-box-shadow: none; | |
-moz-box-shadow: none; |
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
inputs = %w[ | |
CollectionSelectInput | |
DateTimeInput | |
FileInput | |
GroupedCollectionSelectInput | |
NumericInput | |
PasswordInput | |
RangeInput | |
StringInput | |
TextInput |
NewerOlder