Skip to content

Instantly share code, notes, and snippets.

View adrielTosi's full-sized avatar
💻

Adriel Tosi adrielTosi

💻
  • Netcentric Berlin
  • Germany
View GitHub Profile
@adrielTosi
adrielTosi / JSON Timezones
Last active August 2, 2023 03:34
Timezones based on https://github.com/dmfilipenko/timezones.json but with some "fixed" values. The difference is that here the values for `offset` and the `text` show the same value.
[
{
value: 'Dateline Standard Time',
abbr: 'DST',
offset: -12,
isdst: false,
text: '(UTC-12:00) International Date Line West',
utc: ['Etc/GMT+12'],
},
{
@adrielTosi
adrielTosi / gist:cddcfbbf820ab3f46914d1b31d6268c4
Created January 12, 2021 16:08
Make path into crumbs - array of objects with title and link
/**
* Generate breadcrumb based on the path given
* Taken/adapted from here https://github.com/intesso/url-breadcrumb/blob/master/index.js
*/
const generateCrumbsFromPath = (url, opts) => {
// options
opts = opts || {};
opts.home = opts.home || "Home";
opts.endingSlash = opts.endingSlash || false;
opts.beautify =
@adrielTosi
adrielTosi / isUrlAbsolute
Created October 28, 2020 16:50
Check if Url is absolute or relative : has base URL or not
function isUrlAbsolute(url) {
if (url.indexOf("//") === 0) {
return true;
} // URL is protocol-relative (= absolute)
if (url.indexOf("://") === -1) {
return false;
} // URL has no protocol (= relative)
if (url.indexOf(".") === -1) {
return false;
} // URL does not contain a dot, i.e. no TLD (= relative, possibly REST)
@adrielTosi
adrielTosi / StyledButtonEx
Created April 11, 2020 05:57
Example of a styled button design
import React from 'react';
import PropTypes from 'prop-types';
import { Link } from 'react-router-dom';
import styled from 'styled-components';
import { lighten } from 'polished';
import { omit } from 'lodash';
import { fonts, heights, widths, weights } from 'feedr/components/layouts';
import { legacyColors, colors } from 'feedr/theme';
@adrielTosi
adrielTosi / customBullets
Created April 4, 2020 07:08
Custom images as bullets for <li> tag
ul {
list-style: none;
padding-left: 0;
li {
position: relative;
padding-left: $size-9;
&::before {
content: "";
width: 36px;
height: 36px;
@adrielTosi
adrielTosi / Styled Components example
Last active April 3, 2020 19:28
Styled Components example
import styled from 'styled-components';
// Styles that Wrapper will apply to it's children
// This can be exported and used in different files
export const VendorCardWrapper = styled.div`
display: flex;
.card-text {
color: white;
width: 50%;
padding: 60px 35px;
@adrielTosi
adrielTosi / gist:51a453dba1b8b4e1e928f3c2f82517f9
Created September 23, 2019 16:42
Creating the node and links array
@Watch("relationships")
private watchRelationships(relations) {
if (!isEmpty(relations)) {
// WHERE THE NODES ARE CREATED
this.d3NodesData = relations.map(val => {
return {
name: val.userName,
id: val.userId
};
});