Skip to content

Instantly share code, notes, and snippets.

View acfatah's full-sized avatar
🚀
Looking for a new opportunity

Achmad F. Ibrahim acfatah

🚀
Looking for a new opportunity
  • Temerloh, Pahang, Malaysia
  • 08:32 (UTC +08:00)
  • X @acfatah
View GitHub Profile
@acfatah
acfatah / bun-lint-test-typecheck.yml
Created March 7, 2025 00:09 — forked from morajabi/bun-lint-test-typecheck.yml
Bun test, lint, and typecheck your Bun project in GitHub actions with caching
# .github/workflows/test.yml
on:
push:
branches:
- main
pull_request:
branches:
- main
@acfatah
acfatah / acfatah Git Activities
Last active September 4, 2024 10:14
Gist Image Hosting
# Gist Image Hosting on Comment

JavaScript Modules

  1. How do I make the tree shakeable?
  2. What JS module systems should I target (CommonJS, AMD, ES6).
  3. Should I transpile the source?
  4. Should I bundle the source?
  5. What files should I publish?

Let's try to address all the above questions now.

@acfatah
acfatah / bash_strict_mode.md
Created April 1, 2023 02:33 — forked from vncsna/bash_strict_mode.md
set -e, -u, -o, -x pipefail explanation

set -e, -u, -o, -x pipefail

The set lines

  • These lines deliberately cause your script to fail. Wait, what? Believe me, this is a good thing.
  • With these settings, certain common errors will cause the script to immediately fail, explicitly and loudly. Otherwise, you can get hidden bugs that are discovered only when they blow up in production.
  • set -euxo pipefail is short for:
set -e
set -u
@acfatah
acfatah / sleep.js
Last active March 17, 2023 02:38
Javascript ES Module - sleep.js
/**
* Sleep, delay, pause or wait in Javascript
* @link https://www.sitepoint.com/delay-sleep-pause-wait/
* @param {Number} timeout Number in miliseconds
* @return {Promise}
*/
export const sleep = timeout => new Promise(resolve => setTimeout(resolve, timeout))
@acfatah
acfatah / component-app.js
Created February 7, 2023 08:16 — forked from kesor/component-app.js
Vue.js 3.x with ES6 modules in the browser using import-map
import { defineAsyncComponent } from 'vue'
const Content = defineAsyncComponent(() => import('./component-content.js'))
export default {
name: 'App',
components: { Content },
template: /*html*/`
<Content />
`
@acfatah
acfatah / bash_template.sh
Created February 2, 2023 02:46 — forked from rsperl/bash_template.sh
bash script templates #shell #template #snippet
#!/bin/bash
# see also
# - Google's Shell Style Guide: https://google.github.io/styleguide/shell.xml
# - ShellCheck: https://github.com/koalaman/shellcheck
# src:
# - http://hackaday.com/2017/07/21/linux-fu-better-bash-scripting
# - https://dev.to/thiht/shell-scripts-matter
@acfatah
acfatah / unix-digitalocean-spaces-s3cmd.md
Last active January 27, 2023 03:39 — forked from jbutko/unix-digitalocean-spaces-s3cmd.md
Unix (ubuntu): setup and use s3cmd to upload files to digitalocean spaces
@acfatah
acfatah / singleton_logger.rb
Created December 19, 2022 03:21 — forked from cheeyeo/singleton_logger.rb
Simple logger using Ruby's built in Singleton module
require 'singleton'
class SimpleLogger
include Singleton
attr_accessor :level
ERROR=1
WARNING=2
INFO=3
@acfatah
acfatah / authenticable.rb
Created December 7, 2022 08:52 — forked from esteedqueen/authenticable.rb
JSON API User Registration and Sessions with Devise
module Authenticable
# Devise methods overwrite
def current_user
@current_user ||= User.find_by(authentication_token: request.headers['Authorization'])
end
def authenticate_with_token!
render json: { errors: "Not authenticated" },
status: :unauthorized unless user_signed_in?