Skip to content

Instantly share code, notes, and snippets.

View fannyhasbi's full-sized avatar

Fanny Hasbi fannyhasbi

View GitHub Profile
@fannyhasbi
fannyhasbi / app.js
Last active October 27, 2018 02:40
Vue instance for PWA
new Vue({
el:'#app',
data:{
kodepos : [],search : '', awal:0,akhir:10,halaman:1,tampil:true
},
created(){
this.getData();
console.log(this.awal)
},
methods:{
@fannyhasbi
fannyhasbi / index.html
Last active October 27, 2018 02:40
Vue root index
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>Modul PWA</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.1.3/css/bootstrap.min.css">
<link rel="shortcut icon" href="icon/192.ico" type="image/x-icon" />
<link rel="icon" href="https://upload.wikimedia.org/wikipedia/commons/f/f2/Lambang_Kota_Semarang.png" sizes="32x32" />
@fannyhasbi
fannyhasbi / show.php
Last active January 23, 2019 13:08
Force show empty value of a table
<?php
$conn = mysqli_connect("localhost", "root", "", "test") or die(mysql_error());
function check_len($arr, $index, $key){
if(array_key_exists($index, $arr)){
return $arr[$index][$key];
}
return "";
}
@fannyhasbi
fannyhasbi / proto.msg
Created July 25, 2019 02:20 — forked from alexeypegov/proto.msg
ProtoBuffers debug with CURL. ProtoBuffers should be installed first: "yum install protobuf" or "brew install protobuf".
key:"string value"
int_key:22
@fannyhasbi
fannyhasbi / kafka-docker.sh
Created August 26, 2019 10:12
Docker commands to run Kafka using ches/kafka
# Author : Fanny Hasbi
# Web : fannyhasbi.id
# Reference : https://medium.com/rahasak/kafka-and-zookeeper-with-docker-65cff2c2c34f#d972
# Run Zookeper
docker run -d \
--name zookeeper \
-p 2181:2181 \
jplock/zookeeper
@fannyhasbi
fannyhasbi / benchmark-commands.md
Created September 8, 2019 19:25 — forked from ueokande/benchmark-commands.md
Kafka Benchmark Commands

Benchmark commands

Producer

Setup

bin/kafka-topics.sh \
  --zookeeper zookeeper.example.com:2181 \
  --create \
@fannyhasbi
fannyhasbi / axios-catch-error.js
Created June 30, 2020 12:31 — forked from fgilio/axios-catch-error.js
Catch request errors with Axios
/*
* Handling Errors using async/await
* Has to be used inside an async function
*/
try {
const response = await axios.get('https://your.site/api/v1/bla/ble/bli');
// Success 🎉
console.log(response);
} catch (error) {
// Error 😨
@fannyhasbi
fannyhasbi / mac-disable-wired-network-service.sh
Created December 6, 2024 01:05
disable any wired network with USB or LAN as its name
#!/bin/bash
check_wired_network() {
networkServices=$(networksetup -listallnetworkservices | tail -n +2)
while IFS= read -r service; do
if [[ "$service" == \** ]]; then
continue
fi