Skip to content

Instantly share code, notes, and snippets.

View fhur's full-sized avatar

Fernando Hurtado fhur

View GitHub Profile
function mapRecursively(tree, f) {
return {
...f(tree),
children: (tree.children || []).map((child) => mapRecursively(child, f)),
}
}
const FrameNode = {
aspectRatio: null,
blendingEnabled: 0,
@fhur
fhur / CustomFontComponent.tsx
Last active April 29, 2020 16:55
How to use custom fonts withing Framer X Code Components
import * as React from "react";
import { PropertyControls, ControlType } from "framer";
// =================================================
// Step 1: Create a file named app.css in your react component folder
// Import any font you want, e.g.
//
// @import url('https://fonts.googleapis.com/css?family=Gamja+Flower');
//
// Your code folder should look like this:
@fhur
fhur / ImageComponent.tsx
Last active January 9, 2020 04:44
How to reference design components with Framer X
// ================================
// Step 0:
// - Go to the canvas
// - Drop an image from your file system
// - Right click on the image and convert it to a design component
// - Rename the component to `Img1`
// ================================
import * as React from "react";
import { PropertyControls } from "framer";
@fhur
fhur / PhoneEditText.java
Last active August 29, 2015 14:06
EditText that auto formats it's content in a readable way. Numbers are formatted like this: 1234567890 => 123-456-7890
/**
* {@link TextView} that displays only numbers, formated as a readable phone number.
* Example: 123-234-3456 instead of 1232343456
*
* @author fernandohur
*/
public class PhoneEditText extends EditText implements TextWatcher {
private boolean ignoreTextChange;
@fhur
fhur / FontFitTextView.java
Last active August 29, 2015 14:06
TextView that automatically adjusts it's size to fit the container.
/**
* @author fernandohur but credit goes to <a href="http://stackoverflow.com/questions/2617266/how-to-adjust-text-font-size-to-fit-textview">speedplane</a>
*/
public class FontFitTextView extends TextView {
private Paint mTestPaint;
/**
* The minimum font size in pixels
*/
private float minFontSize;

Keybase proof

I hereby claim:

  • I am fhur on github.
  • I am fernandohur (https://keybase.io/fernandohur) on keybase.
  • I have a public key whose fingerprint is 22CA 688C EE6A 65AF 631F 0459 0C7F F04C F454 57E7

To claim this, I am signing this object: