Skip to content

Instantly share code, notes, and snippets.

@ahoNerd
ahoNerd / .htaccess
Created November 12, 2022 17:08
Gzip Compression v1, read more at https://ahonerd.com/htaccess
<IfModule deflate_module>
# Enable compression for the following file types.
AddOutputFilterByType \
DEFLATE \
application/javascript \
text/css \
text/html \
text/javascript \
text/plain \
text/xml
@ahoNerd
ahoNerd / .htaccess
Created November 12, 2022 17:08
Gzip Compression v2, read more at https://ahonerd.com/htaccess
# compress text, html, javascript, css, xml:
AddOutputFilterByType DEFLATE text/plain
AddOutputFilterByType DEFLATE text/html
AddOutputFilterByType DEFLATE text/xml
AddOutputFilterByType DEFLATE text/css
AddOutputFilterByType DEFLATE application/xml
AddOutputFilterByType DEFLATE application/xhtml+xml
AddOutputFilterByType DEFLATE application/rss+xml
AddOutputFilterByType DEFLATE application/javascript
AddOutputFilterByType DEFLATE application/x-javascript
@ahoNerd
ahoNerd / .htaccess
Created November 12, 2022 17:09
Gzip Compression v3, read more at https://ahonerd.com/htaccess
<ifModule mod_gzip.c>
mod_gzip_on Yes
mod_gzip_dechunk Yes
mod_gzip_item_include file \.(html?|txt|css|js|php|pl)$
mod_gzip_item_include mime ^application/x-javascript.*
mod_gzip_item_include mime ^text/.*
mod_gzip_item_exclude rspheader ^Content-Encoding:.*gzip.*
mod_gzip_item_exclude mime ^image/.*
mod_gzip_item_include handler ^cgi-script$
</ifModule>
@ahoNerd
ahoNerd / .htaccess
Created November 12, 2022 17:11
EXPIRES CACHING, read more at https://ahonerd.com/htaccess
<IfModule mod_expires.c>
ExpiresActive On
ExpiresByType text/cache-manifest "access 0 seconds"
ExpiresByType text/xml "access 0 seconds"
ExpiresByType application/xml "access 0 seconds"
ExpiresByType application/json "access 0 seconds"
ExpiresByType application/rss+xml "access 1 hour"
ExpiresByType application/atom+xml "access 1 hour"
ExpiresByType application/pdf "access 1 year"
ExpiresByType application/javascript "access 1 year"
const isMobile = function () {
if (/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)) {
// true apabila mobile device
return true
}
else {
// false apabila bukan mobile device
return false
}
}
@ahoNerd
ahoNerd / remove-last-character.php
Created November 12, 2022 17:24
How to Remove Last Character from a String in PHP, read more at https://ahonerd.com/php-remove-last-character
<?php
$contoh1 = "Berhasil!";
echo $contoh1; // output: Berhasil!
echo "<br>";
echo rtrim($contoh1, "!"); // output: Berhasil
echo "<br>";
$contoh2 = "https://ahonerd.com";
@ahoNerd
ahoNerd / deluge-web.service
Last active May 20, 2023 10:04
Install Deluge on Raspberry Pi, read more at https://ahonerd.com/install-deluge-on-raspberry-pi
[Unit]
Description=Deluge Web Interface
After=network-online.target deluged.service
Wants=deluged.service
[Service]
Type=simple
User=debian-deluged
Group=debian-deluged
UMask=002
@ahoNerd
ahoNerd / setMultipleAttr_1.ts
Created November 14, 2022 04:30
Add Multiple Attribute to an Element using javaScript, read more at https://ahonerd.com/js-add-multiple-attribute
const setMultipleAttr = (elm: any, attributes: any) => {
for (const key in attributes)
elm.setAttribute(key, attributes[key])
}
@ahoNerd
ahoNerd / App-00.vue
Last active November 20, 2022 14:04
Vue 2 with Vuetify Example, read more at https://ahonerd.com/vue-2-vuetify-example
<template>
<v-app>
<v-navigation-drawer
v-model="drawer"
app
clipped
floating
color="indigo lighten-5"
>
<!-- untuk navigasi -->