Skip to content

Instantly share code, notes, and snippets.

View Sensiblemnd's full-sized avatar

Rob Lloveras Sensiblemnd

View GitHub Profile
@Sensiblemnd
Sensiblemnd / gist:523f3c1c0710abbf18b1258b25bf6b81
Last active July 20, 2022 02:11
remover dupes from json boject
View gist:523f3c1c0710abbf18b1258b25bf6b81
var data = {
"name.test": "Peter",
"name.test1": "Steve",
"name.test2": "Steve",
}
@Sensiblemnd
Sensiblemnd / root.css
Created July 29, 2021 20:59
Base Css Root fileexample
View root.css
:root {
--header-height: 3rem;
/*========== Colors ==========*/
/* Change favorite color to match images */
--hue-color: ;
/* HSL color mode */
--color: hsl(var(--hue-color), 64%, 22%);
@Sensiblemnd
Sensiblemnd / README.md
Created July 10, 2021 17:08 — forked from natterstefan/README.md
VSCode | Debug tests in Create-React-App (all or single file)
View README.md

VSCode | Debug tests in Create-React-App (all or single file)

Add launch.json into the .vscode folder.

image

Now, enter the Debug view. Either add debugger into one of the tests or add breakpoints, before you execute one of the scripts.

image

View gist:0d9a23e14470ede1142be7400493efca
const theIndex = {
dog: ()=>{console.log("dog")},
cat: ()=>{console.log("cat")},
rabbit: ()=>{console.log("rabbit")}
}
theIndex["rabbit"] ? theIndex["rabbit"]() : console.log("rabbnothing theret")
@Sensiblemnd
Sensiblemnd / index.html
Created January 26, 2021 21:10 — forked from mcxiaoke/index.html
detect app installed in browser
View index.html
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>App Redirection</title>
</head>
<body>
<!-- iframe used for attempting to load a custom protocol -->
<iframe style="display:none" height="0" width="0" id="loader"></iframe>
View gist:ba70e27d6ea3f1c5273a42c37d1b35b2
import React from "react";
type AccordionType = {
children: React.ReactNode[] | React.ReactNode;
};
const Accordion = (props: AccordionType) => {
return <div className="accordion">{props.children}</div>;
};
//Yay, namespacing!
@Sensiblemnd
Sensiblemnd / js-oneliner.js
Created May 9, 2019 13:24 — forked from hk-skit/js-oneliner.js
Useful Array One-liners.
View js-oneliner.js
// Remove Duplicates from an array
const removeDuplicates =
arr => arr.filter((item, index) => index === arr.indexOf(item));
const removeDuplicates1 = array => [...new Set(array)];
const removeDuplicates2 = array => Array.from(new Set(array));
// Flattens an array(doesn't flatten deeply).
@Sensiblemnd
Sensiblemnd / consecutive_numbers
Last active August 31, 2018 17:53 — forked from XciA/consecutive_numbers
group consecutive numbers in array , in Javascript.
View consecutive_numbers
/*TODO MAKE IT IN ES6
var data=[4,5,6,9,10,14,15,20,21,22,23,24,25,30,31,34]
output
4-6,9-10,14-15,20-25,30-31,34
*/
var data=[4,5,6,9,10,14,15,20,21,22,23,24,25,30,31,34,36,37,94,95];
var start=data[0];
var temp=1;
var a=0;
@Sensiblemnd
Sensiblemnd / not.js
Last active May 30, 2018 15:28
Creates a function out of '!'.
View not.js
//Creates a function out of '!'.
//Use this to improve code readability.
//Instead of... if (!loggedIn) {}
//..do this.. if not(loggedIn) {}
const not = value => !value;
View iphoneXSafeArea.css
/* ==========================================================================
These following classes can be used to add safe-area padding to the either 4 directions
========================================================================== */
.iphoneXSafeArea--top{
/* iOS 11.2+ */
padding-top: env(safe-area-inset-top);
/* iOS 11 */