This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
//configuration | |
$key="API key"; | |
$event="event_name"; | |
//data | |
$data=json_encode(array( "value1"=>"data for value1","value2"=>"data for value2","value3"=>"data for value3")); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
//default time zone | |
date_default_timezone_set("Asia/Jakarta"); | |
//fungsi check tanggal merah | |
function tanggalMerah($value) { | |
$array = json_decode(file_get_contents("https://raw.githubusercontent.com/guangrei/APIHariLibur_V2/main/calendar.json"),true); | |
//check tanggal merah berdasarkan libur nasional | |
if(isset($array[$value]) && $array[$value]["holiday"]) | |
: echo"tanggal merah\n"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
The function below use the latitude and longitude of two locations, and calculate the distance between them in both miles and metric units. | |
function getDistanceBetweenPointsNew($latitude1, $longitude1, $latitude2, $longitude2) { | |
$theta = $longitude1 - $longitude2; | |
$miles = (sin(deg2rad($latitude1)) * sin(deg2rad($latitude2))) + (cos(deg2rad($latitude1)) * cos(deg2rad($latitude2)) * cos(deg2rad($theta))); | |
$miles = acos($miles); | |
$miles = rad2deg($miles); | |
$miles = $miles * 60 * 1.1515; | |
$feet = $miles * 5280; | |
$yards = $feet / 3; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from typing import NoReturn | |
import asyncio | |
import time | |
from random import randint | |
nilai: int = 0 | |
start: int = time.time() | |
async def simulasiProg() -> NoReturn: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
pip install -U Pygments --user | |
echo "alias pcat='pygmentize -g -O style=colorful,linenos=1'" >> ~/.bashrc | |
echo "done!" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
use Clue\React\Buzz\Browser; | |
use Psr\Http\Message\ResponseInterface; | |
require "vendor/autoload.php"; | |
$url = "http://jendela.data.kemdikbud.go.id/api/index.php/cwilayah/wilayahKabGet"; | |
$loop = React\EventLoop\Factory::create(); | |
$browser = new Browser($loop); | |
$browser->get($url)->then( |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
DOMAIN=$1 | |
PORT=$2 | |
if [ $# -eq 0 ] ; then | |
echo "No arguments supplied" | |
echo "Usage: command DOMAIN PORT" | |
exit 1 | |
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# ~/.bashrc: executed by bash(1) for non-login shells. | |
# see /usr/share/doc/bash/examples/startup-files (in the package bash-doc) | |
# for examples | |
. /etc/apache2/envvars | |
# If not running interactively, don't do anything else | |
[ -z "$PS1" ] && return | |
# don't put duplicate lines or lines starting with space in the history. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function str_replace_word($cari, $ganti, $kalimat) | |
{ | |
$cek = strpos($kalimat, " "); | |
if ($cek != false) { | |
$token = explode(" ", $kalimat); | |
$map = array_map(function($val) use ($cari, $ganti) | |
{ | |
return $val === $cari ? $ganti : $val; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from http.server import BaseHTTPRequestHandler | |
from urllib import parse | |
from http.server import HTTPServer | |
class GetHandler(BaseHTTPRequestHandler): | |
def do_GET(self): | |
parsed_path = parse.urlparse(self.path) | |
res = """ |
OlderNewer