Skip to content

Instantly share code, notes, and snippets.

View darkterminal's full-sized avatar
🕺
Dancing While Coding

Imam Ali Mustofa darkterminal

🕺
Dancing While Coding
View GitHub Profile
@ajs
ajs / mj_cheat_sheet.md
Last active June 3, 2024 10:14
Midjourney Cheat Sheet

A Cheat Sheet of Midjourney control phrases

[descriptions based on v4]

  • fine ultra-detailed realistic - Can be a bit grainy and "ropey" but increases detail generation
  • ultra photorealistic - Simiar to "fine ultra-detailed realistic"
  • Hasselblad H6D - Sharper focus on subect; shadows are deepened
  • high definition - Shadows are lightened; more fanciful and saturated colors
  • 8k - Lighting tends to be more extreme; colors even more saturated and computer-generated looking than "high definition"
  • cinematic - Shadows tend to be more extreme (though not darker); objects a bit thicker; more poster-like
import canvas from '@napi-rs/canvas' // For canvas.
import fs from 'fs' // For creating files for our images.
import cwebp from 'cwebp' // For converting our images to webp.
// Load in the fonts we need
GlobalFonts.registerFromPath('./fonts/Inter-ExtraBold.ttf', 'InterBold');
GlobalFonts.registerFromPath('./fonts/Inter-Medium.ttf','InterMedium');
GlobalFonts.registerFromPath('./fonts/Apple-Emoji.ttf', 'AppleEmoji');
// This function accepts 6 arguments:
@srsandy
srsandy / ColumnFilter.js
Last active January 11, 2024 06:54
React Table Server side Pagination and Filtering
import "regenerator-runtime/runtime";
import { useState } from "react";
import { useAsyncDebounce } from "react-table";
const ColumnFilter = ({ column }) => {
const { filterValue, setFilter } = column;
const [value, setValue] = useState(filterValue);
const onChange = useAsyncDebounce((value) => {
setFilter(value || undefined);
}, 300);
@bschaatsbergen
bschaatsbergen / docker-compose.yml
Last active May 20, 2024 07:54
multi-node elasticsearch cluster
version: '2.2'
services:
es01:
image: docker.elastic.co/elasticsearch/elasticsearch:7.12.0
container_name: es01
environment:
- node.name=es01
- cluster.name=es-docker-cluster
- discovery.seed_hosts=es02,es03
- cluster.initial_master_nodes=es01,es02,es03
@ionurboz
ionurboz / debounce-throttle.md
Last active April 10, 2024 02:55
Simple JavaScript debounce and throttle (Pure, Vanilla, Plain JS)

If you've written any kind of validation on user input, like onkeypress then you'll know that sometimes you want to throttle the amount of times your function runs. A good example of this is Ajax based username validation - you don't want to hit the server on every key press, because most users will be able to write their name in around 1/10th of a second, so you should throttle the ajax request until the input is dormant for 100ms.

So with a bit of magic JavaScript making use of the ever useful closure JavaScript offers, we can create a simple method to handle this for us:

function debounce(fn, delay) {
  var timer = null;
  return function () {
    var context = this, args = arguments;
    clearTimeout(timer);
 timer = setTimeout(function () {
@leandrocrs
leandrocrs / git_cleanup_non_remote_branches.sh
Created July 13, 2020 19:31
command to cleanup all local branch without remote
git fetch --prune | git branch -r | awk '{print $1}' | egrep -v -f /dev/fd/0 <(git branch -vv | grep origin) | awk '{print $1}' | xargs git branch -D
Error:
$ adb devices
List of devices attached
52003c2b58b445db no permissions (user in plugdev group; are your udev rules wrong?); see [http://developer.android.com/tools/device.html]
Fix:
1> sudo usermod -aG plugdev $LOGNAME (https://developer.android.com/studio/run/device)
2> lsusb
3> sudo vi /etc/udev/rules.d/51-android.rules

MySQL Cheat Sheet

Help with SQL commands to interact with a MySQL database

MySQL Locations

  • Mac /usr/local/mysql/bin
  • Windows /Program Files/MySQL/MySQL version/bin
  • Xampp /xampp/mysql/bin

Add mysql to your PATH

@romeryto
romeryto / jp-ur.json
Created November 30, 2018 05:14
jp-ur.json
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@bradtraversy
bradtraversy / docker-help.md
Last active July 9, 2024 10:18
Docker Commands, Help & Tips

Docker Commands, Help & Tips

Show commands & management commands

$ docker

Docker version info