Skip to content

Instantly share code, notes, and snippets.

@didacus
didacus / property.js
Created February 7, 2019 08:53
Framer X — Property Controls
import * as React from 'react'
import { PropertyControls, ControlType } from 'framer'
// Define type of property
export interface Props {
text: string,
color: string,
boolean: boolean,
numberA: number,
numberB: number,
@didacus
didacus / reuse-animation.js
Last active February 5, 2019 11:39
Framer X - Reuse animations - create by Jay Stakelon
import { Data, animate, Override, Animatable } from "framer";
// Set an array to keep each scaleValues
const data = Data({ scaleValues: [] });
export const Scale: Override = props => {
// Add to the array the id and the animation value
data.scaleValues.push({ id: props.id, scaleValue: Animatable(1) });
return {
// Pass the current id to the function
@didacus
didacus / chaining.js
Created February 4, 2019 17:21
Framer X - Chaining animations
export const ScaledAwait: Override = () => {
return {
scale: data.scale,
onTap: async () => {
await animate.spring(data.scale, 0.5).finished
await animate.spring(data.scale, 1.5).finished
await animate.spring(data.scale, 0.5).finished
console.log('finished!')
},
}
@didacus
didacus / Tab.js
Last active September 12, 2018 14:52
Playground — TabComponent
import React from 'react'
import styled from 'styled-components'
const Tab = ({ onClick, isSelected, children }) => {
const TabWrapper = styled.li`
width: 48px;
display: flex;
align-items: center;
justify-content: center;
padding: 20px;
sdk.dir = /Users/diegooriani/Library/Android/sdk
@didacus
didacus / loading_unsigned_apk.txt
Created May 10, 2018 13:24
Loading APK into the Android device.
react-native bundle --dev false --platform android --entry-file index.js --bundle-output ./android/app/build/intermediates/assets/debug/index.android.bundle --assets-dest ./android/app/build/intermediates/res/merged/debug
cd android
./gradlew assembleDebug
adb install -r ./app/build/outputs/apk/app-debug.apk
@didacus
didacus / gitURL.txt
Last active May 3, 2018 16:24
Change GitHub repo URL
git remote set-url origin NEWURL
@didacus
didacus / setInterval.js
Created March 6, 2018 10:33
setInterval
// Refresh by executing the fuction every 45 seconds
setInterval(() => this._fetchArrivalTimes(), 45000);
@didacus
didacus / react.js
Last active July 26, 2017 11:53
React — Iterating on multiple instaces from an API
class App extends React.Component {
render() {
return (
<ul>
<Data />
</ul>
)
}
}
@didacus
didacus / App.js
Last active July 15, 2017 14:08
How to use fetch
import React, { Component } from 'react'; //import 'React' default export, and { Component } non-default export from react
import fetch from 'isomorphic-fetch'; // isomorphic-fetch is used for both server side and client side 'fetch' (see https://github.com/matthew-andrews/isomorphic-fetch)
// App.css was a hangover from the create-react-app, it's not really needed for this basic example
const url = 'https://api.tfl.gov.uk/BikePoint'; // API
class App extends Component { // This is the same as 'extends 'React.Component'