Skip to content

Instantly share code, notes, and snippets.

View iqbalfasri's full-sized avatar
🤓
🙃 🛵

Muhammad Iqbal Fasri iqbalfasri

🤓
🙃 🛵
View GitHub Profile
@ptenteromano
ptenteromano / photos.tsx
Last active March 28, 2024 10:42
Infinite Scroll with Remix Run
/*
* Infinite Scroll using Remix Run
* Based on client-side Scroll position
* Full Article here: https://dev.to/ptenteromano/infinite-scroll-with-remix-run-1g7
*/
import { useEffect, useState, useCallback } from "react";
import { LoaderFunction, useLoaderData, useFetcher } from "remix";
import { fetchPhotos } from "~/utils/api/restful";
import type { PhotoHash } from "~/utils/api/types";
@sambatlim
sambatlim / save_image.js
Created July 25, 2021 07:30
Script to generate save image from each group in photoshop.
function Main() {
var num = 1;
for (var j = 0; j < app.activeDocument.layerSets[0].layers.length; j++) {
for (var k = 0; k < app.activeDocument.layerSets[1].layers.length; k++) {
for (var l = 0; l < app.activeDocument.layerSets[2].layers.length; l++) {
var groupChildArr1 = app.activeDocument.layerSets[0].layers;
var groupChildArr2 = app.activeDocument.layerSets[1].layers;
@headwinds
headwinds / serverless-postgres-config
Created June 16, 2021 12:54
serverless postgreSQL config
import { Dialect } from 'sequelize/types';
export const config = {
database: {
dialect: 'postgres' as Dialect,
host: 'ruby.db.elephantsql.com',
port: 5432,
username: 'your-username-here',
password: 'your-password-here',
database: 'your-database-here',
@Luccasoli
Luccasoli / useReactNavigationQuery
Created May 14, 2021 23:44
useQuery layer implementing refetchOnWindowFocus in react-native project using react-navigation
import { useFocusEffect } from '@react-navigation/core';
import { useCallback } from 'react';
import {
QueryFunction,
QueryKey,
useQuery,
UseQueryOptions,
UseQueryResult,
} from 'react-query';
@asruldev
asruldev / tes-password.js
Created March 20, 2020 03:01
Strong Password
/*
Min 1 number
Min 1 A-Z
Min 1 a-z
Min value 8
max value 25
*/
const re = new RegExp(/(?=^.{8,25}$)(?=(?:.*?\d){1})(?=.*[a-z])/);
@m-tymchyk
m-tymchyk / is-iphone-x.js
Last active July 5, 2021 22:36
React Native / How to determine if on iPhone X or XR
// is-iphone-x.js
import { Dimensions, Platform } from 'react-native';
export function isIphoneX() {
const dim = Dimensions.get('window');
return (
// This has to be iOS
Platform.OS === 'ios' &&
@tabrindle
tabrindle / webp-convert-directory.sh
Last active April 30, 2024 14:03
Convert all files in directory to webp, with default params, or standard cwebp params passed from command
#!/bin/bash
PARAMS=('-m 6 -q 70 -mt -af -progress')
if [ $# -ne 0 ]; then
PARAMS=$@;
fi
cd $(pwd)
@lalkmim
lalkmim / codility_solutions.txt
Last active April 25, 2024 21:47
Codility Solutions in JavaScript
Lesson 1 - Iterations
- BinaryGap - https://codility.com/demo/results/trainingU2FQPQ-7Y4/
Lesson 2 - Arrays
- OddOccurrencesInArray - https://codility.com/demo/results/trainingFN5RVT-XQ4/
- CyclicRotation - https://codility.com/demo/results/trainingSH2W5R-RP5/
Lesson 3 - Time Complexity
- FrogJmp - https://codility.com/demo/results/training6KKWUD-BXJ/
- PermMissingElem - https://codility.com/demo/results/training58W4YJ-VHA/
@ejdyksen
ejdyksen / patch-edid.md
Last active April 6, 2024 15:59
A script to fix EDID problems on external monitors in macOS

patch-edid.rb

A script to fix EDID problems on external monitors in macOS.

Instructions

  1. Connect only the problem display.

  2. Create this directory structure (if it doesn't already exist):

@rastating
rastating / USNetflixHosts
Created November 27, 2013 22:04
A hosts file to use to access the US Netflix using the Unblock US service without using their DNS for all of your traffic.
# Hosts file to access US Netflix using Unblock US without their DNS.
67.216.222.61 movies.netflix.com
67.216.222.65 cbp-us.nccp.netflix.com
67.216.222.130 movies1.netflix.com
67.216.222.104 movies2.netflix.com
147.255.171.14 netflix.com
147.255.171.7 moviecontrol.netflix.com
69.197.181.166 api-global.netflix.com
67.216.222.83 api-us.netflix.com
147.255.227.2 api.netflix.com