Skip to content

Instantly share code, notes, and snippets.

View Rolando-Barbella's full-sized avatar
🏄
Surfing

Rolando Rolando-Barbella

🏄
Surfing
View GitHub Profile
@Rolando-Barbella
Rolando-Barbella / Root.ts
Last active March 20, 2023 15:45
React Native examples
import React, {useEffect, useState} from 'react';
import {StatusBar} from 'react-native';
import {NavigationContainer} from '@react-navigation/native';
import {createStackNavigator} from '@react-navigation/stack';
import Heap from '@heap/react-native-heap';
import {useAsyncStorage} from '@react-native-async-storage/async-storage';
import {Provider as PaperProvider} from 'react-native-paper';
import {OrientationLocker, PORTRAIT} from 'react-native-orientation-locker/src/OrientationLocker';
import {useReactiveVar} from '@apollo/client';
import {LightNavigationTheme, DarkNavigationTheme, LightPaperTheme, DarkPaperTheme} from '@styles/theme';
interface Worker {
name: string,
surname: string,
deparment: 'ENGINEERING' | 'SALES',
skills: Array<string>,
};
interface Developer extends Worker {
type: 'FRONT-END' | 'FULL-STACK',
import Color from "color";
import brandStore from "./brand-store";
const defaultColours = [
{ name: "primary", value: "#333" },
{ name: "secondary", value: "#222" },
{ name: "tertiary", value: "#555" },
];
const defaultBodyFont = "Lato";
@Rolando-Barbella
Rolando-Barbella / clear.txt
Created September 27, 2018 13:25 — forked from EQuimper/clear.txt
React-Native clear Watchman + Cache
watchman watch-del-all && rm -rf node_modules/ && yarn cache clean && yarn install && yarn start -- --reset-cache
@Rolando-Barbella
Rolando-Barbella / clear.txt
Created September 27, 2018 13:25 — forked from EQuimper/clear.txt
React-Native clear Watchman + Cache
watchman watch-del-all && rm -rf node_modules/ && yarn cache clean && yarn install && yarn start -- --reset-cache
var isSquare = function (n) {
return n >= 0 && Math.sqrt(n) % 1 === 0 ? true : false;
}
// Sum of a sequence
const sequenceSum = (begin, end, step) => {
if (begin > end) {
return 0;
}
return begin + sequenceSum(begin + step, end, step);
@Rolando-Barbella
Rolando-Barbella / functional-utils.js
Created April 2, 2018 10:39 — forked from bendc/functional-utils.js
A set of pure ES2015 functions aimed to make functional JavaScript more idiomatic.
// array utils
// =================================================================================================
const combine = (...arrays) => [].concat(...arrays);
const compact = arr => arr.filter(Boolean);
const contains = (() => Array.prototype.includes
? (arr, value) => arr.includes(value)
: (arr, value) => arr.some(el => el === value)
@Rolando-Barbella
Rolando-Barbella / functional-utils.js
Created March 28, 2018 17:05 — forked from addyosmani/functional-utils.js
A set of pure ES2015 functions aimed to make functional JavaScript more idiomatic.
// Examples at https://gist.github.com/bendc/9b05735dfa6966859025#gistcomment-1370485
// array utils
// =================================================================================================
const combine = (...arrays) => [].concat(...arrays);
const compact = arr => arr.filter(Boolean);
@Rolando-Barbella
Rolando-Barbella / HOC.js
Created March 23, 2018 23:10 — forked from Restuta/HOC.js
React HOC (Higher Order Component) Example
/* HOC fundamentally is just a function that accepts a Component and returns a Component:
(component) => {return componentOnSteroids; } or just component => componentOnSteroids;
Let's assume we want to wrap our components in another component that is used for debugging purposes,
it just wraps them in a DIV with "debug class on it".
Below ComponentToDebug is a React component.
*/
//HOC using Class
//it's a function that accepts ComponentToDebug and implicitly returns a Class
let DebugComponent = ComponentToDebug => class extends Component {
@Rolando-Barbella
Rolando-Barbella / README.md
Created February 8, 2018 22:12 — forked from addyosmani/README.md
108 byte CSS Layout Debugger

CSS Layout Debugger

A tweet-sized debugger for visualizing your CSS layouts. Outlines every DOM element on your page a random (valid) CSS hex color.

One-line version to paste in your DevTools

Use $$ if your browser aliases it:

~ 108 byte version