Skip to content

Instantly share code, notes, and snippets.

View ayatmaulana's full-sized avatar
🔥
Focusing

Ayat Maulana ayatmaulana

🔥
Focusing
View GitHub Profile
1. **Channel:**
Buatlah sebuah program Go yang menggunakan channel untuk mengirim data dari satu goroutine ke goroutine lainnya. Goroutine pertama harus mengirimkan angka genap dari 0 hingga 10 ke goroutine kedua, yang kemudian mencetak angka tersebut.
2. **Defer & Exit:**
Tulis program Go yang menunjukkan penggunaan defer untuk membersihkan sumber daya (file, koneksi, dll.) ketika program keluar. Program ini harus membuka sebuah file, menulis sesuatu ke dalamnya, dan kemudian keluar dengan menutup file tersebut menggunakan defer.
3. **Panic & Error:**
Buatlah fungsi dalam Go yang menerima input bilangan bulat positif. Jika input tersebut negatif, fungsi harus menimbulkan panic, dan jika input tersebut nol, fungsi harus mengembalikan error. Tulis program yang menangani panic dan error dari fungsi ini.
BASE_URL='http://alpha.cognitix.id/'
APIKEY='73c78dd8eae3b0e05b726f7de4e9c19bf5ac90f1'
@ayatmaulana
ayatmaulana / python3_install.sh
Last active August 1, 2019 15:34
python3_install.sh
wget https://www.python.org/ftp/python/3.7.0/Python-3.7.0.tar.xz
tar xf Python-3.7.0.tar.xz
cd Python-3.7.0
./configure
make -j 4
sudo make altinstall
sudo apt-get update -y
sudo apt-get install build-essential cups mongodb cmake libcups2-dev libcupsimage2-dev tk-dev libncurses5-dev libncursesw5-dev libreadline6-dev libdb5.3-dev libgdbm-dev libsqlite3-dev libssl-dev libbz2-dev libexpat1-dev liblzma-dev zlib1g-dev libffi-dev -y
{
"_id" : ObjectId("5d22b146deff6bc314d3a195"),
"questionandanswer" : [
{
"isCorrect" : "wrong",
"question" : {
"Score" : 1.0,
"QuizCategoryID" : 1.0,
"UpdatedAt" : "2019-07-07T13:12:37Z",
"Question" : "Berapakah tenor maksimal untuk produk Mobil Baru pada Program DAEP?",
{
"_id" : ObjectId("5d18787ef02e063f7d29feb8"),
"agenda" : {
"model" : {
"id" : 18,
"createdat" : ISODate("2019-06-30T06:15:27.000Z"),
"updatedat" : ISODate("2019-06-30T07:33:52.000Z"),
"deletedat" : null
},
"name" : "Makan",

PouchDB sebagai alternative LocalStorage pada Browser

Salah satu limitasi pada LocalStorage pada browser adalah dia hanyalah sebuah key - value storage yang di simpan dalam browser dan juga hanya bisa menyimpan tipe data String saja, tidak bisa menyimpan data Array maupun Object, sehingga apabila developer ingin menyimpan tipe data tersebut kedalam LocalStorage, developer harus mengubahnya terlebih dahulu kedalam bentuk JSON String, dan tentunya dari hal tersebut menjadikan kita sebagai developer menjadi tidak bebas atau leluasa dalam menyimpan data pada local storage.

Dengan limitasi tersebut tentunya membuat proses development menjadi sedikit terhambat, maka dari itu kita sebagai developer membutuhkan suatu alat yang powerful, yang bisa membuat kita menjadi lebih bebas dalam urusan menyimpan data.

# PouchDB sebagai alternative LocalStorage pada Browser
![](https://av-uploads.s3.amazonaws.com/articel_upload/pouchdb_logo.png)
> PouchDB is an open-source JavaScript database inspired by Apache CouchDB that is designed to run well within the browser.
> PouchDB was created to help web developers build applications that work as well offline as they do online.
It enables applications to store data locally while offline, then synchronize it with CouchDB and compatible servers when the application is back online, keeping the user's data in sync no matter where they next login.
> (source: https://pouchdb.com)
#!/bin/sh
# http://www.alfredklomp.com/programming/shrinkpdf
# Licensed under the 3-clause BSD license:
#
# Copyright (c) 2014, Alfred Klomp
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
@ayatmaulana
ayatmaulana / provider.php
Created March 10, 2019 12:26
check indonesia provider by phone number
<?php
$providerList = [
"telkomsel" => [
"0811",
"0812",
"0813",
"0821",
"0822",
"0823",