Skip to content

Instantly share code, notes, and snippets.

@CroModder
CroModder / .prettierrc.js
Created July 29, 2021 13:36
Linter(eslint and stylelint) with Prettier config
module.exports = {
trailingComma: "es5",
semi: true,
singleQuote: true,
useTabs: true,
printWidth: 120
};
@CroModder
CroModder / task_1-test.js
Last active September 6, 2017 09:22
cloudsense
const findSumIndex = require('./task_1');
describe('findSumIndex', () => {
it('should return -1 | Input [1,2,3]', () => {
expect(findSumIndex([1,2,3])).toBe(-1);
});
it('should return 0 | Input [1]', () => {
expect(findSumIndex([1])).toBe(0);
});

Unit Tests in Vue.js

Tooling

{
  "karma-mocha": "^0.2.1",
  "karma-chai": "^0.1.0",
  "karma-chai-as-promised": "^0.1.2",
  "karma-sinon": "^1.0.4",
@CroModder
CroModder / arrayEquals.js
Created August 23, 2017 17:14
Method for array comparison
// Source: https://stackoverflow.com/questions/7837456/how-to-compare-arrays-in-javascript
// Warn if overriding existing method
if(Array.prototype.equals)
console.warn("Overriding existing Array.prototype.equals. Possible causes: New API defines the method, there's a framework conflict or you've got double inclusions in your code.");
// attach the .equals method to Array's prototype to call it on any array
Array.prototype.equals = function (array) {
// if the other array is a falsy value, return
if (!array)
return false;
@CroModder
CroModder / debug2console.php
Last active July 28, 2016 12:50
debug2Console
/**
* http://stackoverflow.com/questions/4323411/how-can-i-write-to-console-in-php#answer-37218530
* Simple helper to debug to the console
*
* @param $data object, array, string $data
* @param $context string Optional a description.
*
* @return string
*/
function debug_to_console( $data, $context = 'Debug in Console' ) {
@CroModder
CroModder / dabblet.css
Created May 24, 2014 22:05 — forked from LeaVerou/dabblet.css
iOS 6 style switch checkboxes
/**
* iOS 6 style switch checkboxes
* by Lea Verou http://lea.verou.me
*/
:root input[type="checkbox"] { /* :root here acting as a filter for older browsers */
position: absolute;
opacity: 0;
}