Skip to content

Instantly share code, notes, and snippets.

const camelCaseToKebabCase = (value) => {
if (typeof value !== 'string') return value
return value.replace(/[A-Z]/g, (char, index, wholeValue) => {
return wholeValue[index] = `${index === 0 ? '' : '-'}${char.toLowerCase()}`
})
}
const getStyles = (element) => {
const elementStyles = {}
{
"list": [
{
"id": "1",
"name": "Jane Doe",
"totalPoints": 157,
"clicks": 5
},
{
"id": "2",
@d7my11
d7my11 / upgrade-wdio-v5.js
Last active August 19, 2019 13:20
replace webdriver.io legacy commands with version 5 commands
// HOW TO USE IT
// just add a new file to your project directory
// change `BASE_DIR` -if needed-
// run `node upgrade-wdio-v5.js`
// then `git status` to see the changes
const fs = require('fs')
const BASE_DIR = 'ui-test/'
import open from 'open';
import express from 'express';
import webpack from 'webpack';
import config from './webpack.config.dev';
import conf from './conf';
/* eslint-disable no-console */
const port = 3000;
const app = express();
{
"data":
[
{
"id": 1,
"date": "27-2-2017",
"content": "This is my first Card content",
"title": "This is my first Card"
},
{
{
"results": [
{ "title": "Lorem Ipsum is simply dummy text",
"images":
[
"https://unsplash.it/458/354?image=1083",
"https://unsplash.it/458/354?image=877"
]
},
{ "title": "Lorem Ipsum is simply dummy text",
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title></title>
</head>
<body>
hi there
</body>
</html>
import $ from 'jquery';
import CONFIG from '../configs';
import transText from './transText';
/**
* Editable Field Utility
* @description
* Custom utility that is implementing an editable fields.
* @class EditableField
* @param options - Instance options
var doc = "practice makes perfect. get perfect by practice. just practice!;";
var wordCountEngine = {
init: function (doc) {
var newDoc = this.removePunctuation(doc);
newDoc = newDoc.split(" ");
var cleanDoc = newDoc;
newDoc = this.getSolidDoc(newDoc);
@d7my11
d7my11 / app.js
Last active August 21, 2016 18:27
angular change state without reload
var original = $location.path;
$location.path = function (path, reload) {
if (reload === false) {
var lastRoute = $route.current;
var un = $rootScope.$on('$locationChangeSuccess', function () {
$route.current = lastRoute;
un();
});
}
return original.apply($location, [path]);