Skip to content

Instantly share code, notes, and snippets.

@madindo
madindo / unix_to_datestamp.js
Created August 27, 2014 09:32
Unix to datestamp javascript
var theDate = new Date(content.publish_date * 1000);
var date = theDate.getDate();
var month = theDate.getMonth() + 1;
var month = month < 10 ? '0' + month : month ; //Months are zero based
var year = theDate.getFullYear();
var hour = theDate.getHours();
var min = theDate.getMinutes();
var sec = theDate.getSeconds();
console.log(year + "-" + month + "-" + date + " " + hour + ":" + min + ":" + sec);
@madindo
madindo / PHP Countries Array
Created December 13, 2016 10:25 — forked from DHS/PHP Countries Array
PHP array of all country names
<?php
$countries = array("Afghanistan", "Albania", "Algeria", "American Samoa", "Andorra", "Angola", "Anguilla", "Antarctica", "Antigua and Barbuda", "Argentina", "Armenia", "Aruba", "Australia", "Austria", "Azerbaijan", "Bahamas", "Bahrain", "Bangladesh", "Barbados", "Belarus", "Belgium", "Belize", "Benin", "Bermuda", "Bhutan", "Bolivia", "Bosnia and Herzegowina", "Botswana", "Bouvet Island", "Brazil", "British Indian Ocean Territory", "Brunei Darussalam", "Bulgaria", "Burkina Faso", "Burundi", "Cambodia", "Cameroon", "Canada", "Cape Verde", "Cayman Islands", "Central African Republic", "Chad", "Chile", "China", "Christmas Island", "Cocos (Keeling) Islands", "Colombia", "Comoros", "Congo", "Congo, the Democratic Republic of the", "Cook Islands", "Costa Rica", "Cote d'Ivoire", "Croatia (Hrvatska)", "Cuba", "Cyprus", "Czech Republic", "Denmark", "Djibouti", "Dominica", "Dominican Republic", "East Timor", "Ecuador", "Egypt", "El Salvador", "Equatorial Guinea", "Eritrea", "Estonia", "Ethiopia", "Falkland Island
@madindo
madindo / kota_indonesia.php
Created December 13, 2016 10:32
Isi kota indonesia berupa array
$KOTA = [ "Ambon","Balikpapan","Banda Aceh","Bandar Lampung","Bandung","Banjar","Banjarbaru","Banjarmasin","Batam","Batu","Bau-Bau","Bekasi","Bengkulu","Bima","Binjai","Bitung","Blitar","Bogor","Bontang","Bukittinggi","Cilegon","Cimahi","Cirebon","Denpasar","Depok","Dumai",",orontalo","Gunungsitoli","Jakarta Barat","Jakarta Pusat","Jakarta Selatan","Jakarta Timur","Jakarta Utara","Jambi","Jayapura","Kediri","Kendari","Kotamobagu","Kupang","Langsa",",hokseumawe","Lubuklinggau","Madiun","Magelang","Makassar","Malang","Mamuju","Manado","Mataram","Medan","Metro","Mojokerto","Padang","Padangpanjang","Padangsidempuan","Pagar Alam","Palangka Raya","Palembang","Palopo","Palu","Pangkal Pinang","Parepare","Pariaman","Pasuruan","Payakumbuh","Pekalongan","Pekanbaru","Pematangsiantar","Pontianak","Prabumulih","Probolinggo","Sabang","Salatiga","Samarinda","Sawahlunto","Semarang","Serang","Sibolga","Singkawang","Solok","Sorong","Subulussalam","Sukabumi","Sungai Penuh","Surabaya","Surakarta","Tangerang","Tangerang Selatan","
@madindo
madindo / .bash_profile
Last active November 28, 2018 04:22 — forked from JeffreyWay/.bash_profile
Laravel aliases
# laravel new-app
alias laravel="git clone -o laravel -b develop https://github.com/laravel/laravel.git"
alias artisan="php artisan"
alias migrate="php artisan migrate"
alias serve="php artisan serve"
alias dump="php artisan dump"
alias t="phpunit"
# Generators Package
@madindo
madindo / menu_main.xml
Last active July 11, 2019 02:19
Android Material Design Popup Menu
<menu xmlns:android="http://schemas.android.com/apk/res/android">
<item
android:title="@string/item_1"
android:id="@+id/item1_id" />
<item
android:title="@string/item_2"
android:id="@+id/item2_id" />
<item
android:title="@string/item_3"
android:id="@+id/item3_id" />
@madindo
madindo / main_activity.java
Created July 11, 2019 02:21
Android Material Design Popup Menu
@Override
public boolean onCreateOptionsMenu(Menu menu) {
getMenuInflater().inflate(R.menu.menu_main, menu);
return true;
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
int id = item.getItemId();
package com.madindo.fotofilio;
import android.content.Intent;
import android.os.Handler;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
public class MainActivity extends AppCompatActivity {
private static int SPLASH_TIME_OUT = 4000;
protected function mapAmpRoutes()
{
Route::group([
'middleware' => 'web',
'namespace' => $this->namespace,
'prefix' => 'amp',
], function ($router) {
require base_path('routes/amp.php');
});
}
<link rel='manifest' href='/manifest.json'>
<script>
// Check compatibility for the browser we're running this in
if ("serviceWorker" in navigator) {
if (navigator.serviceWorker.controller) {
console.log("[PWA Builder] active service worker found, no need to register");
} else {
// Register the service worker
navigator.serviceWorker
@madindo
madindo / install-wp.sh
Created December 9, 2020 00:34 — forked from BFTrick/install-wp.sh
Download & Install WordPress via Curl
curl -O https://wordpress.org/latest.zip
unzip latest.zip
mv wordpress site
rm latest.zip