Skip to content

Instantly share code, notes, and snippets.

@madindo
madindo / unix_to_datestamp.js
Created Aug 27, 2014
Unix to datestamp javascript
View unix_to_datestamp.js
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 Dec 13, 2016 — forked from DHS/PHP Countries Array
PHP array of all country names
View PHP Countries Array
<?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 Dec 13, 2016
Isi kota indonesia berupa array
View kota_indonesia.php
$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 Nov 28, 2018 — forked from JeffreyWay/.bash_profile
Laravel aliases
View .bash_profile
# 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
View env temp
APP_NAME=Muslimadani
APP_ENV=local
APP_KEY=base64:b1Ph6yo9V9DvzUtiFFrtVTZzX0yJPb54L0tKgrOK+KM=
APP_DEBUG=true
APP_LOG_LEVEL=debug
APP_URL=http://localhost:8000
DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
@madindo
madindo / menu_main.xml
Last active Jul 11, 2019
Android Material Design Popup Menu
View menu_main.xml
<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 Jul 11, 2019
Android Material Design Popup Menu
View main_activity.java
@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();
View SplashActivity.java
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;
View RouteServiceProvider.php
protected function mapAmpRoutes()
{
Route::group([
'middleware' => 'web',
'namespace' => $this->namespace,
'prefix' => 'amp',
], function ($router) {
require base_path('routes/amp.php');
});
}
View index.html
<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