Skip to content

Instantly share code, notes, and snippets.

View hoppula's full-sized avatar

Lari Hoppula hoppula

View GitHub Profile
@GavinRay97
GavinRay97 / index.md
Last active April 12, 2024 18:31
Hasura organization permissions

Introduction

This document outlines how to model a common organization-based permission system in Hasura. Let's assume that you have some table structure like the following:

Table Name Columns Foreign Keys
User id, name, email
Organization User id, user_id, organization_id user_id -> user.id, organization_id -> organization.id
Organization id, name
@ntamvl
ntamvl / example-use-aws-sdk-mock-to-test-aws-ssm.md
Last active February 17, 2023 15:56
Example: use aws-sdk-mock to test AWS SSM

Use aws-sdk-mock to test AWS SSM

Example:

const AWSMock = require("aws-sdk-mock");
import AWS = require("aws-sdk");
AWSMock.setSDKInstance(AWS);

import "mocha";
@gaearon
gaearon / prepack-gentle-intro-1.md
Last active May 3, 2024 12:56
A Gentle Introduction to Prepack, Part 1

Note:

When this guide is more complete, the plan is to move it into Prepack documentation.
For now I put it out as a gist to gather initial feedback.

A Gentle Introduction to Prepack (Part 1)

If you're building JavaScript apps, you might already be familiar with some tools that compile JavaScript code to equivalent JavaScript code:

  • Babel lets you use newer JavaScript language features, and outputs equivalent code that targets older JavaScript engines.
@kitze
kitze / store.js
Created January 24, 2018 13:14
simplified redux
import produce from 'immer';
import {createStore} from 'redux';
const handleActions = (actionsMap, defaultState) => (
state = defaultState,
{type, payload}
) =>
produce(state, draft => {
const action = actionsMap[type];
action && action(draft, payload);
@CodingDoug
CodingDoug / README.md
Last active December 17, 2022 10:23
Copying data from Firebase Realtime Database to a Google Sheet in real time via Cloud Functions
@samthecodingman
samthecodingman / adminTaskFunction.js
Last active November 4, 2017 06:29
Defines a helper class to create Firebase Functions that handle recurring tasks that are triggered using the Firebase Realtime Database.
/*! adminTaskFunction.js | Samuel Jones 2017 | MIT License | github.com/samthecodingman */
/**
* @file Defines a helper class to create Firebase Functions that handle recurring tasks that are triggered using the Firebase Realtime Database.
* @author Samuel Jones (github.com/samthecodingman)
*/
const functions = require('firebase-functions')
const lodashGet = require('lodash').get;
@sadikay
sadikay / google_fonts.css
Created April 26, 2017 22:34
All Google Fonts In One CSS File
@font-face {
font-family: 'ABeeZee';
font-style: normal;
font-weight: 400;
src: local('ABeeZee'), local('ABeeZee-Regular'), url(http://fonts.gstatic.com/s/abeezee/v9/JYPhMn-3Xw-JGuyB-fEdNA.ttf) format('truetype');
}
@font-face {
font-family: 'Abel';
font-style: normal;
font-weight: 400;
@dolfelt
dolfelt / ConnectedRouter.js
Created October 27, 2016 13:07
ConnectedRouter for using react-router v4 with Redux
import React, { Component, PropTypes } from 'react';
import createBrowserHistory from 'history/createBrowserHistory';
import History from 'react-router/History';
import StaticRouter from 'react-router/StaticRouter';
import { LOCATION_CHANGE } from './routerReducer';
class DispatchingRouter extends Component {
static propTypes = {
store: PropTypes.object,
@ericclemmons
ericclemmons / example.md
Last active April 24, 2024 18:09
HTML5 <details> in GitHub

Using <details> in GitHub

Suppose you're opening an issue and there's a lot noisey logs that may be useful.

Rather than wrecking readability, wrap it in a <details> tag!

<details>
 Summary Goes Here
@jareware
jareware / package-json-engines.md
Last active October 30, 2020 18:36
Enforcing the engines property of package.json

Document your target environment with:

"engines": {
  "npm": ">=3.3.12 <4",
  "node": ">=5.5.0 <6"
},

Then install this:

"devDependencies": {