# Output "Angka: 10"
angka = 10
if angka > 5
Petunjuk untuk cara mudah ngoding offline
- Copy paste kode di bawah
- Save menggunakan text editor (notepad,notepad++,sublime dll) dengan "namanya_terserah.html"
- Buka file namanya_terserah.html menggunakan browser.
- Lalu klik kanan di browser -> pilih inspect/Inspect Element -> pilih Console.
- Perhatikan hasil outputnya.
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
<!DOCTYPE html> | |
<html> | |
<head> | |
<style type="text/css"> | |
html, body { height: 100%; margin: 0; padding: 0; } | |
#map { height: 100%; } | |
</style> | |
</head> | |
<body> |
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
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta name="viewport" content="initial-scale=1.0, user-scalable=no"> | |
<meta charset="utf-8"> | |
<title>Simple markers</title> | |
<style> | |
html, body { | |
height: 100%; | |
margin: 0; |
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
var marker = new google.maps.Marker({ | |
position: myLatLng, | |
map: map, | |
title: 'Hello World!' | |
}); |
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
<div id="map"></div> | |
<script> | |
function initMap() { | |
var myLatLng = {lat: 1.12321, lng: 160.123232}; | |
var map = new google.maps.Map(document.getElementById('map'), { | |
zoom: 8, | |
center: myLatLng | |
}); | |
} | |
</script> |
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
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta name="viewport" content="initial-scale=1.0, user-scalable=no"> | |
<meta charset="utf-8"> | |
<title>Simple markers</title> | |
<style> | |
html, body { | |
height: 100%; | |
margin: 0; |
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
$(document).ready -> | |
$('.delete_photo').each -> | |
$(this).click -> | |
if confirm("Are you sure to delete photo?") | |
photo_id = $(this).attr('data-value') | |
$(this).on "ajax:success",() -> | |
alert("Photo deleted successfully") | |
$("a[data-value="+photo_id+"]").remove() | |
$("#photo"+photo_id).remove() |
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
<div class="field"> | |
<%= f.label 'Photos' %><br> | |
<% 10.times do |i| %> | |
Photo <%= i + 1 %> | |
<%= file_field_tag "photos[#{i}]", accept: 'image/png,image/jpeg' %> | |
<%= @photo_gallery.photos[i].nil? ? '' : label_tag(@photo_gallery.photos[i].image_file_name,nil,id: "photo#{@photo_gallery.photos[i].id}") %> | |
<!-- add link to delete single photo object below --> | |
<%= @photo_gallery.photos[i].nil? ? '' : link_to('Hapus Foto',@photo_gallery.photos[i],remote: true, method: :delete,:class => "delete_photo", data: {value: @photo_gallery.photos[i].id}) %><br><br> | |
<% end %> | |
</div> |
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
<%= form_for(@photo_gallery,:html => {multipart: true}) do |f| %> | |
<% if @photo_gallery.errors.any? %> | |
<div id="error_explanation"> | |
<h2><%= pluralize(@photo_gallery.errors.count, "error") %> prohibited this photo_gallery from being saved:</h2> | |
<ul> | |
<% @photo_gallery.errors.full_messages.each do |message| %> | |
<li><%= message %></li> | |
<% end %> | |
</ul> |
NewerOlder