Skip to content

Instantly share code, notes, and snippets.

@didacus
didacus / config.json
Created February 23, 2017 12:09
portfolio config.json
{
"vars": {
"@gray-base": "#000",
"@gray-darker": "lighten(@gray-base, 13.5%)",
"@gray-dark": "lighten(@gray-base, 20%)",
"@gray": "lighten(@gray-base, 33.5%)",
"@gray-light": "lighten(@gray-base, 46.7%)",
"@gray-lighter": "lighten(@gray-base, 93.5%)",
"@brand-primary": "darken(#428bca, 6.5%)",
"@brand-success": "#5cb85c",
@didacus
didacus / scrollTrigger.js
Last active May 25, 2017 06:56
Framer - Scroll trigger
# Scroll Trigger
scrollTrigger = (layer, source, start, overFunc, underFunc) ->
# Setup
layer.globalY = layer.convertPointToScreen().y
layer.offsetStart = (layer.globalY+source.contentInset.top)-start
# Checker
triggerChecker = () ->
@didacus
didacus / cursorState.js
Created May 25, 2017 06:59
Framer - Cursor state
# Affordances
affordances = []
createAffordances = (index) ->
affordances[index].onMouseOver ->
document.body.style.cursor = "pointer"
affordances[index].onMouseOut ->
document.body.style.cursor = "auto"
for i in [0...affordances.length]
@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'
@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 / setInterval.js
Created March 6, 2018 10:33
setInterval
// Refresh by executing the fuction every 45 seconds
setInterval(() => this._fetchArrivalTimes(), 45000);
@didacus
didacus / gitURL.txt
Last active May 3, 2018 16:24
Change GitHub repo URL
git remote set-url origin NEWURL
@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
sdk.dir = /Users/diegooriani/Library/Android/sdk
@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;