Skip to content

Instantly share code, notes, and snippets.

View ajmalafif's full-sized avatar
💻

Ajmal Afif ajmalafif

💻
View GitHub Profile
// Framer X Utils.modulate equivalent
function modulate(value, rangeA, rangeB, limit = false) {
const [fromLow, fromHigh] = rangeA;
const [toLow, toHigh] = rangeB;
const result = toLow + ((value - fromLow) / (fromHigh - fromLow)) * (toHigh - toLow);
if (limit === true) {
if (toLow < toHigh) {
if (result < toLow) {
return toLow;
import React from 'react'
import PropTypes from 'prop-types'
import { kebabCase } from 'lodash'
import Helmet from 'react-helmet'
import { graphql, Link } from 'gatsby'
import tachyons from 'tachyons-components'
import Layout from '../components/Layout'
import Content, {HTMLContent} from '../components/Content'
import SEO from '../components/Seo'
# Getting data from the CoinMarketCap API
coins = JSON.parse Utils.domLoadDataSync 'https://api.coinmarketcap.com/v1/ticker/'
# Create a Scroll componnent, that will wrap all coinRows
list = new ScrollComponent
width: Screen.width
height: Screen.height
# Set the backgrond color for the scroll content
list.content.backgroundColor = '#FFFFFF'
@ajmalafif
ajmalafif / create-pages-blogs.js
Created April 7, 2019 09:09 — forked from tanaypratap/create-pages-blogs.js
Creating Pages in Gatsby from different data sources and template
/** extracted page creation functionality into smaller functions **/
const path = require('path');
function createBlogPostsPages(result, createPage) {
const blogPostTemplate = path.join(__dirname, `../src/templates/blog-post.js`);
const blogPosts = result.data.blogs.edges;
blogPosts.forEach((post, index) => {
const previous = index === blogPosts.length - 1 ? null : blogPosts[index + 1].node;
export const ExperiencePageQuery = graphql`
query ExperiencePage($id: String!) {
markdownRemark(id: { eq: $id }) {
html
frontmatter {
title
heading
description
intro {
blurbs {
@ajmalafif
ajmalafif / package.json
Created February 2, 2019 18:17 — forked from stefanjudis/package.json
Cached SQIP implementation on Netlify
{
"name": "sqip-cache-tryout",
"version": "1.0.0",
"description": "",
"main": "",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"keywords": [],
"author": "stefan judis <stefanjudis@gmail.com>",
@ajmalafif
ajmalafif / CustomDevide.coffee
Created January 19, 2019 17:54 — forked from koenbok/CustomDevide.coffee
Custom Framer Device
Framer.Device.Devices["my-device"] =
name: "My Device"
deviceType: "mobile"
deviceImage: "my-device.png"
deviceImageWidth: 472
deviceImageHeight: 806
screenWidth: 320
screenHeight: 400
@ajmalafif
ajmalafif / layout.js
Created December 16, 2018 15:14
Gatsby-interUI layout.js
import { createGlobalStyle } from 'styled-components'
import * as font from '../utils/font'
import React from 'react'
import PropTypes from 'prop-types'
import Helmet from 'react-helmet'
import { StaticQuery, graphql } from 'gatsby'
import Header from './header'
const GlobalStyle = createGlobalStyle`
@font-face {
@ajmalafif
ajmalafif / timeline.md
Created November 24, 2018 18:00
Timeline app
# Insomnia Configuration
## Run the test query
{
shop {
id
name
}
}
# Query Structure Examples