Skip to content

Instantly share code, notes, and snippets.

View edgarberm's full-sized avatar
:octocat:
NaN

Edgar Bermejo edgarberm

:octocat:
NaN
View GitHub Profile
@benigumocom
benigumocom / SpeechBubble.swift
Last active April 5, 2025 23:39
【SwiftUI】Create Animated Speech Bubble 👉 https://android.benigumo.com/20240827/speech-bubble/
import SwiftUI
struct SpeechBubble: View {
var count: Int
var body: some View {
HStack(spacing: 0) {
Rectangle()
.fill(.red)
.rotationEffect(.degrees(45))
@1Marc
1Marc / reactive.js
Last active May 23, 2025 09:50
Vanilla Reactive System
// Credit Ryan Carniato https://frontendmasters.com/courses/reactivity-solidjs/
let context = [];
export function untrack(fn) {
const prevContext = context;
context = [];
const res = fn();
context = prevContext;
return res;
@gaelreyrol
gaelreyrol / ReadMe.md
Created July 15, 2021 16:26
Copy Github cards to another project

Copy Github cards to another project

Usage

  • Create an access token with permission on projects.
  • Install with npm @octokit/core and dotenv.
  • Create a .env file with ACCESS_TOKEN=mytoken
  • Copy/paste this script in an index.js file.
  • Get column ids for source and destination.
@aceslowman
aceslowman / CapsuleGeometry.js
Last active January 2, 2022 11:08
Capsule Geometry for ThreeJS
import * as THREE from "three";
/*
Implemented from a technique described here:
http://paulbourke.net/geometry/capsule/
PID2 taken from Paul Bourke's paulslib.h
PID2 = 1.570796326794896619231322;
ISSUES:
@jorilallo
jorilallo / Flex.js
Created August 17, 2017 20:06
Flexbox component for React
// @flow
import React from 'react';
import styled from 'styled-components';
type GlobalCssValues = 'initial' | 'inherit' | 'unset';
type WrapValue = 'nowrap' | 'wrap' | 'wrap-reverse' | GlobalCssValues;
type JustifyValue =
| 'center'
@mksarge
mksarge / actions.js
Created June 13, 2017 06:53
A minimal Redux-first routing implementation in <100 lines of code. Learn more: https://medium.com/@mksarge/98926ebf53cb
import { PUSH, REPLACE, GO, GO_BACK, GO_FORWARD, LOCATION_CHANGE } from './constants';
export const push = (href) => ({
type: PUSH,
payload: href,
});
export const replace = (href) => ({
type: REPLACE,
payload: href,
@robinloeffel
robinloeffel / _grid-ie-calc.scss
Last active June 5, 2024 21:52
Dynamic CSS Grid Items in Internet Explorer and Edge - https://grid-ie-calc.surge.sh
/*
This mixin allows us use CSS grid without having to think about
what -ms-grid-row/-ms-grid-column we have to assign to a grid element
for it to properly work on Internet Explorer and Edge.
It takes three arguments, the last one of which is optional. Specify the
maximum amount of items you want to have in your grid, when they should
break to the next line and, if you like, a grid-gap of some sort.
// routes.js
const routes = [
{
path: '/',
component: Home,
exact: true
},
{
path: '/gists',
component: Gists
@mike-casas
mike-casas / install-nvm-zsh.txt
Last active January 31, 2025 13:48
install nvm on mac with zsh shell
After install zsh
- brew update
- brew install nvm
- mkdir ~/.nvm
after in your ~/.zshrc or in .bash_profile if your use bash shell:
export NVM_DIR=~/.nvm
source $(brew --prefix nvm)/nvm.sh
@developit
developit / async-examples.js
Last active February 19, 2020 00:43
Async Array utilities in async/await. Now available as an npm package: https://github.com/developit/asyncro
/** Async version of Array.prototype.reduce()
* await reduce(['/foo', '/bar', '/baz'], async (acc, v) => {
* acc[v] = await (await fetch(v)).json();
* return acc;
* }, {});
*/
export async function reduce(arr, fn, val, pure) {
for (let i=0; i<arr.length; i++) {
let v = await fn(val, arr[i], i, arr);
if (pure!==false) val = v;