Skip to content

Instantly share code, notes, and snippets.

View goker-dev's full-sized avatar
🦁
Working from home

goker goker-dev

🦁
Working from home
View GitHub Profile
@lambdaxyzt
lambdaxyzt / image.jsx
Last active June 9, 2024 09:46
Remix Image Component ( use cache 'cacashe library' , stream base , sharp library )
// resource route component
import React from "react";
import { PassThrough } from "node:stream"
import fs from "node:fs"
import {createReadableStreamFromReadable} from "@remix-run/node"
import { defaultQuality,widths,mainImageReadStream,generatedImageReadstream, isThereImage,BadImageResponse } from "../../util/image.server"
export const loader = async ({ request }) => {
const url = new URL(request.url);
const src = url.searchParams.get("src");
@tavinus
tavinus / puppeteerDebianHeadless.md
Created September 11, 2020 09:14
Minimal Puppeteer NodeJS Debian 10 Buster

System

Debian 10 Buster headless

Chromium dependencies

Shared Libraries needed

$ sudo apt install libnss3 libatk1.0-0 libatk-bridge2.0-0 libcups2 libgbm1 libasound2 libpangocairo-1.0-0 libxss1 libgtk-3-0

Install nvm

Local user

@jamesfulford
jamesfulford / clear-service-workers.js
Created March 16, 2020 01:59
Clear Service Workers, Cypress
// From https://github.com/cypress-io/cypress/issues/702#issuecomment-435873135
beforeEach(() => {
if (window.navigator && navigator.serviceWorker) {
navigator.serviceWorker.getRegistrations()
.then((registrations) => {
registrations.forEach((registration) => {
registration.unregister();
});
});
}
@yishn
yishn / takeScreenShot.js
Created November 21, 2019 12:27
Take screenshot in the browser
const canIRun = navigator.mediaDevices.getDisplayMedia
const takeScreenShot = async () => {
const stream = await navigator.mediaDevices.getDisplayMedia({
video: { mediaSource: 'screen' },
})
// get correct video track
const track = stream.getVideoTracks()[0]
// init Image Capture and not Video stream
const imageCapture = new ImageCapture(track)
@observer
class TodoList extends React.Component {
render() {
const store = this.props.store;
return (
<div>
{ store.report }
<ul>
{ store.todos.map(
(todo, idx) => <TodoView todo={ todo } key={ idx } />
@richogreen
richogreen / bitbucket-pipelines.yml
Created October 25, 2018 01:40
BitBucket Pipelines configuration for Create React App build and deployment to AWS S3 with CloudFront cache
# This is a sample build configuration for JavaScript.
# Check our guides at https://confluence.atlassian.com/x/14UWN for more examples.
# Only use spaces to indent your .yml configuration.
# -----
# You can specify a custom docker image from Docker Hub as your build environment.
image: node:6.9.4
pipelines:
default:
- step:
@scottopell
scottopell / fix_exfat_drive.md
Last active July 25, 2024 23:37
Fix corrupted exFAT disk macOS/OSX

exFAT support on macOS seems to have some bugs because my external drives with exFAT formatting will randomly get corrupted.

Disk Utility is unable to repair this at first, but the fix is this:

  1. Use diskutil list to find the right drive id.
  2. You want the id under the IDENTIFIER column, it should look like disk1s1
  3. Run sudo fsck_exfat -d <id from above>. eg sudo fsck_exfat -d disk1s3
  4. -d is debug so you'll see all your files output as they're processed.
  5. Answer YES if it gives you the prompt Main boot region needs to be updated. Yes/No?
@minhoryang
minhoryang / README.md
Created November 21, 2016 11:04
MacOS Dynamic Global Hostname + DNSimple +
@priyadarshitathagat
priyadarshitathagat / pre_post_to_infix.c
Last active March 21, 2023 17:29
Postfix to Infix and Prefix to Infix conversion in c using stacks
#include<stdio.h>
#include<conio.h>
#include<string.h>
#include<stdlib.h>
# define MAX 20
char str[MAX],stack[MAX];
int top=-1;
void push(char c)
{
stack[++top]=c;
@patkujawa-wf
patkujawa-wf / git diff patch between branches.md
Created April 3, 2014 18:36
If you want to get the difference between two branches as a diff patch

If you want to get the difference between two branches, say master and branch-name, use the following command: git diff master..branch-name

If you want that same diff in a patch, because patches are handy, just add the output redirect: git diff master..branch-name > branch-name.patch

If you need to import that patch into something like Crucible then you'll need to get rid of the a and b prefixes that git adds: git diff --no-prefix master..branch-name > branch-name.patch