Skip to content

Instantly share code, notes, and snippets.

View zaydek's full-sized avatar
🤠
Howdy!

Zaydek MG zaydek

🤠
Howdy!
View GitHub Profile
@danestves
danestves / aspect.css
Created February 13, 2020 22:53
Aspect Radios to use with tailwindcss
.embed-responsive {
@apply relative;
}
.embed-responsive::before {
@apply block;
content: "";
}
.embed-responsive .embed-responsive-item,
@sbatson5
sbatson5 / multiple-firestore-queries.js
Last active February 26, 2020 09:35
Multiple firestore queries
const firebase = require('firebase');
function getCurrentEventsByStateForAdmins(state) {
const db = firebase.firestore();
db.collection('events')
.orderBy('expirationDate', 'asc')
.where('expirationDate', '>', new Date().toISOString())
.where('state', '==', state)
.where('isAdmin', '==', true)
@owainlewis
owainlewis / README.md
Last active March 11, 2020 16:35
OCI S3 API with Golang

OCI + S3

Oracle Cloud Infrastructure offers an S3 compatible API for object storage.

This example will show you how to use it with the AWS Go SDK

Configuration

Endpoint

const MarkdownArray = [
// `<Comment />`.
{ syntax: /^\/\/(.*)(?:$|\n)/,
parser: (key, [children]) => <Comment key={key} children={parseText(children)} /> },
// `<Header />`.
{ syntax: /^(#{1,6})( .*)(?:$|\n)/,
parser: (key, [open, children]) => <Header key={key} open={open} children={parseText(children)} /> },
@ww9
ww9 / gui_apps_using_go_html_js_css.md
Last active September 1, 2020 19:32
Simple GUI example using https://github.com/zserge/lorca. Shows Go<->Js communication. #go

GUI programs using Go and HTML/CSS/JS

Superior to similar solutions. Doesn't use electron or cgo. Easy communication between Go and Js. Can easily use libs like React, Vue and Angular.

This is a demo app using GUI library https://github.com/zserge/lorca which requires only Chrome and might even work with Firefox in the future.

@penguinbroker
penguinbroker / gist:1378258
Created November 19, 2011 01:15
Paper.js hit test
hitTool = new paper.Tool();
hitTool.activate();
hitTool.onMouseDown = function (event) {
hitOptions = {
segments: true,
stroke: true,
fill: true,
tolerance: 5
};
hitResult = paper.project.hitTest(event.point, hitOptions);
@mattpocock
mattpocock / machine.js
Created July 28, 2020 08:19
Generated by XState Viz: https://xstate.js.org/viz
// Available variables:
// - Machine
// - interpret
// - assign
// - send
// - sendParent
// - spawn
// - raise
// - actions
import { useEffect, useReducer } from 'react';
type State<TState, TEffect> = TState & {
effects?: TEffect[];
};
export type UseFsmReducerEffects<TAction, TEffect extends { type: string }> = {
[K in TEffect['type']]: (params: {
effect: Extract<TEffect, { type: K }>;
dispatch: (action: TAction) => void;
// styled component version
const Container = styled.div`
/*all of the styles*/
`
function MyComponent() {
return <Container>{/*other stuff*/}</Container>
}
// css prop version
@steveruizok
steveruizok / render-state.js
Last active November 17, 2020 14:01
Render a State Designer state in the terminal.
import log from "ololog"
class Grid {
rows = []
width = 0
height = 0
chars = {
active: ["┌", "─", "┒", "┃", "┛", "━", "┕", "│"],
inactive: ["┌", "─", "┐", "│", "┘", "─", "└", "│"],