Skip to content

Instantly share code, notes, and snippets.

View garmjs's full-sized avatar
🏍️
Lover

Armend Gashi garmjs

🏍️
Lover
  • Prishtine
View GitHub Profile
@garmjs
garmjs / graphql.ts
Created November 5, 2019 10:04 — forked from mfellner/graphql.ts
Using Apollo Server in Next.js 9 with API route in pages/api/graphql.ts
import { ApolloServer, gql } from 'apollo-server-micro';
const typeDefs = gql`
type Query {
sayHello: String
}
`;
const resolvers = {
Query: {
@garmjs
garmjs / gist:f1eafd23fe1232ad31dc79974e847bff
Last active November 15, 2019 22:32 — forked from CristinaSolana/gist:1885435
Keeping a fork up to date

1. Clone your fork:

git clone git@github.com:YOUR-USERNAME/YOUR-FORKED-REPO.git

2. Add remote from original repository in your forked repository:

cd into/cloned/fork-repo
git remote add upstream git://github.com/ORIGINAL-DEV-USERNAME/REPO-YOU-FORKED-FROM.git
git fetch upstream

git branch --set-upstream-to=upstream/master master

@garmjs
garmjs / useMeasure.js
Created July 3, 2019 11:41 — forked from stolinski/useMeasure.js
useMeasure - taken from React Spring example
import { useRef, useState, useEffect } from 'react'
import ResizeObserver from 'resize-observer-polyfill'
export default function useMeasure() {
const ref = useRef()
const [bounds, set] = useState({ left: 0, top: 0, width: 0, height: 0 })
const [ro] = useState(() => new ResizeObserver(([entry]) => set(entry.contentRect)))
useEffect(() => (ro.observe(ref.current), ro.disconnect), [])
return [{ ref }, bounds]
}
@garmjs
garmjs / util-elastic-collision.js
Created October 12, 2017 17:40 — forked from christopher4lis/util-elastic-collision.js
A set of utility functions used to reproduce the effect of elastic collision within HTML5 canvas.
/**
* Rotates coordinate system for velocities
*
* Takes velocities and alters them as if the coordinate system they're on was rotated
*
* @param Object | velocity | The velocity of an individual particle
* @param Float | angle | The angle of collision between two objects in radians
* @return Object | The altered x and y velocities after the coordinate system has been rotated
*/
@garmjs
garmjs / IntroductionToFlow.md
Created October 9, 2017 02:29 — forked from busypeoples/IntroductionToFlow.md
Introduction To Flow

Introduction To Flow

Intended for developers interested in getting started with Flow. At the end of this introduction, you should have a solid understanding of Flow and how to apply it when building an application.

Covers all the basics needed to get started with Flow.

Covers all the basic needed to get started with Flow and ReactJS.

@garmjs
garmjs / FlowTutorial.js
Created October 2, 2017 20:48 — forked from busypeoples/FlowTutorial.js
Flow Fundamentals For JavaScript Developers
// @flow
// Flow Fundamentals For JavaScript Developers
/*
Tutorial for JavaScript Developers wanting to get started with FlowType.
Thorough walkthrough of all the basic features.
We will go through the basic features to gain a better understanding of the fundamentals.
You can uncomment the features one by one and work through this tutorial.
@garmjs
garmjs / tmux-cheatsheet.markdown
Created March 30, 2017 16:32 — forked from MohamedAlaa/tmux-cheatsheet.markdown
tmux shortcuts & cheatsheet

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname
@garmjs
garmjs / ReactRouterv4 CodeSpliting.js
Last active July 31, 2017 12:37 — forked from acdlite/app.js
Quick and dirty code splitting with React Router v4
import React from 'react'
import { Loading } from '../components/loading'
function asyncComponent (getComponent) {
return class AsyncComponent extends React.Component {
static Component = null
mounted = false
state = {
Component: AsyncComponent.Component
@garmjs
garmjs / introrx.md
Created January 23, 2016 03:33 — forked from staltz/introrx.md
The introduction to Reactive Programming you've been missing
@garmjs
garmjs / 0_reuse_code.js
Created January 24, 2014 00:30
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console