Skip to content

Instantly share code, notes, and snippets.

View segunadebayo's full-sized avatar
😃

Segun Adebayo segunadebayo

😃
View GitHub Profile
@segunadebayo
segunadebayo / rename-camel-to-dash.js
Created August 26, 2020 08:21 — forked from finalclass/rename-camel-to-dash.js
recursively renames every file and directory in the script path from camelCase and UpperCamelCase to dash-case
/*jshint node:true*/
'use strict';
/**
* This scripts recursively renames every file and directory in the script path
* from camelCase and UpperCamelCase to dash-case
*
* Do a backup before executing this script
*
* @lecense MIT
@segunadebayo
segunadebayo / apollo-middleware.js
Created September 5, 2020 14:10
Applying Middleware to Apollo Server
const { ApolloServer, gql, makeExecutableSchema } = require('apollo-server')
const { applyMiddleware } = require('graphql-middleware')
const uppercaseCategory = async (resolve, parent, args, context, info) => {
const result = await resolve(parent, args, context, info)
return result.toUpperCase()
}
const postsMiddleware = async (resolve, parent, args, context, info) => {

Keybase proof

I hereby claim:

  • I am segunadebayo on github.
  • I am segunadebayo (https://keybase.io/segunadebayo) on keybase.
  • I have a public key ASBtVZhQf8x-7k_u2iDgxtq2GHJ7Y_95v2SS0-viWQg2fwo

To claim this, I am signing this object:

@segunadebayo
segunadebayo / markdown-reset.css
Last active September 24, 2020 08:39 — forked from chakhsu/reset.css
[markdown reset css] #css
/* Reset
=============================================================================*/
html, body, div, span, applet, object, iframe, h1, h2, h3, h4, h5, h6, p, blockquote, pre, a, abbr, acronym, address, big, cite, code, del, dfn, em, img, ins, kbd, q, s, samp, small, strike, strong, sub, sup, tt, var, b, u, i, center, dl, dt, dd, ol, ul, li, fieldset, form, label, legend, table, caption, tbody, tfoot, thead, tr, th, td, article, aside, canvas, details, embed, figure, figcaption, footer, header, hgroup, menu, nav, output, ruby, section, summary, time, mark, audio, video {
margin: 0;
padding: 0;
border: 0;
}
/* Body
export interface PaginationOptions {
total: number;
current: number;
noOfSiblings?: number;
}
export function pagination(options: PaginationOptions) {
const { total, noOfSiblings, current } = validate(options);
const max = 2 * noOfSiblings + 5;
const menuMachine = Machine(
{
id: "menu-machine",
initial: "idle",
context: {
activeDescendantId: null,
menuId: "",
buttonId: "",
onSelect: () => {}
},
// Available variables:
// - Machine
// - interpret
// - assign
// - send
// - sendParent
// - spawn
// - raise
// - actions
@segunadebayo
segunadebayo / getComponents.js
Created June 28, 2021 21:52 — forked from steveruizok/getComponents.js
Get components and styles (as full nodes) from a Figma file.
async function getComponents(fileKey, token) {
// Get file
const file = await fetch(`https://api.figma.com/v1/files/${fileKey}`, {
headers: { "X-Figma-Token": token }
}).then((r) => r.json())
if (file.err === undefined) {
// Get style ids
const styleIds = Object.keys(file.styles)
@segunadebayo
segunadebayo / results.json
Created June 28, 2021 21:57 — forked from steveruizok/results.json
result of figma api request
{
"document": {
"id": "0:0",
"name": "Document",
"type": "DOCUMENT",
"children": [
{
"id": "0:1",
"name": "Page 1",
"type": "CANVAS",
@segunadebayo
segunadebayo / ideas.md
Last active October 2, 2021 13:00
Ideas for Static CSS Generation of JSX Style Props
// Button.js => Button.css
import { chakra } from "@chakra-ui/magic";
import "@chakra-ui/css/Button.css";

<chakra.button mb="2" mt="2" _hover={{ bg: "red.200", _focus: {} }} />;

<button css={{mb: "2", mt="2", _hover: { bg: "red.200", _focus: {} }} />

const result = interpret(