Skip to content

Instantly share code, notes, and snippets.

Set status

Wildan Zulfikar wzulfikar

Set status
View GitHub Profile
kentcdodds / package.json
Last active Mar 4, 2021
Validates that the versions of tools specified in `engines` in the package.json are installed on the machine.
View package.json
"name": "workshop-computer-validator",
"version": "1.0.0",
"description": "I use this to validate people's computers have the proper versions of node and npm installed for a workshop",
"bin": "./validate-system.js",
"dependencies": {
"semver": "7.1.3"
derindutz / use-persistent-swr.ts
Last active Jan 29, 2021
useSWR with localforage as a persistent cache
View use-persistent-swr.ts
import useSWR from '@zeit/swr';
import localForage from 'localforage';
import { ConfigInterface } from '@zeit/swr/dist/src/types';
import { useState, useEffect } from 'react';
export function usePersistentSWR(key: string, fn?: Function, config?: ConfigInterface) {
let handleSuccess;
if (config !== undefined && config.onSuccess !== undefined) {
const { onSuccess } = config;
handleSuccess = (data: any, key: string, config: ConfigInterface) => {
mfellner / graphql.ts
Created Jul 8, 2019
Using Apollo Server in Next.js 9 with API route in pages/api/graphql.ts
View graphql.ts
import { ApolloServer, gql } from 'apollo-server-micro';
const typeDefs = gql`
type Query {
sayHello: String
const resolvers = {
Query: {
chibicode /
Last active Mar 2, 2021
A dead simple React.js Twemoji component.

Twemoji + React

A dead simple React Twemoji component.

Requirements: twemoji

npm install --save twemoji
baymac /
Created Jan 1, 2019
App Script to send the response from Google Form to Firebase
function onFormSubmit(e) {
var form = FormApp.openById('1Z65umQSZ2drz3MvTWCWlwP4-ySeoB5D7RvX1LtusnEU');
var formResponses = form.getResponses();
var latestResponse = formResponses.length - 1;
var formResponse = formResponses[latestResponse];
var email = formResponse.getRespondentEmail();
var items = formResponse.getItemResponses();
for file in $(./ipfs refs local);
if ! [[ $(./ipfs cat "$file" 2>&1 >/dev/null | grep 'Error') ]] ; then
if ! [[ $(./ipfs cat "$file" | file - | grep ': data') ]] ; then
printf "=== LOCAL FILE FOUND ===\n\n"
echo $file
./ipfs cat "$file" | file -
printf "\n\n"


With a single import _ "net/http/pprof" you can add profiling endpoints to a HTTP server.

package main

import (
mholt / macapp.go
Created May 18, 2018
Distribute your Go program (or any single binary) as a native macOS application
View macapp.go
// Package main is a sample macOS-app-bundling program to demonstrate how to
// automate the process described in this tutorial:
// Bundling the .app is the first thing it does, and creating the DMG is the
// second. Making the DMG is optional, and is only done if you provide
// the template DMG file, which you have to create beforehand.
// Example use:
aurorabbit /
Last active Aug 5, 2020
Bitbar timely progress bar
# add this to your bitbar directory
# don't forget to chmod +x
# width and characters for the progress bars
# feel free to configure these
magjac /
Last active Jan 27, 2021
D3 Graphviz GUI editor proof-of-concept

This is a proof-of-concept of a graphical editor that allows you to to edit a Graphviz graph graphically, by drawing edges between nodes and inserting new nodes by using the mouse only. It also allows you to edit the textual DOT language description and directly see the graph transform itself into a new layout in an animated transition.

The GUI editor is perfectly usable as it is, but it has some simplifications that needs to be addressed in a production quality application in order not to hamper productivity:

  • Draws only the standard type edge with alternating colors, although you can edit all aspects of it with the text editor afterwards and see the changes directly.
  • Draws only two kinds of node shapes, alternating between ellipse and polygon and different colors and using predefined names. Also this can of course be changed with the text editor.

Help is available by clicking the question mark in the top right corner.

This sma