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
<script> | |
document.addEventListener("DOMContentLoaded", function() { | |
let images = document.querySelectorAll("img"); | |
images.forEach(img => { | |
img.addEventListener("error", function () { | |
console.log("Broken image: ", img); | |
img.src = `https://fakeimg.pl/${img.width}x${img.height}/`; | |
}); | |
let xhr = new XMLHttpRequest(); |
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
fun main() { | |
val aaa = ArrayList<String>() | |
aaa.add("Mobil") | |
aaa.add("Motor") | |
var bbb = ArrayList<String>() | |
for(row in aaa) { | |
if(row.lowercase().contains("mot")) { | |
bbb.add(row) | |
} | |
} |
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
package com.example.viewbindingexample | |
import androidx.appcompat.app.AppCompatActivity | |
import android.os.Bundle | |
import com.example.viewbindingexample.databinding.ActivityMainBinding | |
class MainActivity : AppCompatActivity() { | |
private lateinit var binding: ActivityMainBinding |
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
function save(blob) { | |
const url = window.URL.createObjectURL(blob); | |
const a = document.createElement('a'); | |
a.style.display = 'none'; | |
a.href = url; | |
a.download = 'zip_10MB.zip'; //filename | |
document.body.appendChild(a); | |
a.click(); | |
window.URL.revokeObjectURL(url); | |
alert('your file has downloaded!'); |
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
function createFolder (folder_name, success) { | |
document.addEventListener('deviceready', () => { | |
let path = cordova.file.documentsDirectory+"NoCloud/" | |
window.resolveLocalFileSystemURL(path, e => { | |
e.getDirectory(`${folder_name}`, { create: true, exclusive: false }, success, error => console.log(error)); | |
}, error => console.log(error)) | |
}) | |
} |
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
function checkFolder (folder_name, found, notFound) { | |
document.addEventListener('deviceready', () => { | |
let path = cordova.file.documentsDirectory+"NoCloud/" | |
window.resolveLocalFileSystemURL(path, e => { | |
e.getDirectory(`${folder_name}`, {create: false}, found, notFound); | |
}, error => console.log(error)) | |
}) | |
} |
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
const localSet = (key, value) => { | |
return new Promise(resolve => { | |
resolve(localStorage.setItem(key, value)) | |
}) | |
} | |
Promise.all([ | |
localSet('KeyA', 'ValueA'), | |
localSet('KeyB', 'ValueB'), | |
localSet('KeyC', 'ValueC') |
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
$.ajax({ | |
url: "https://file-examples-com.github.io/uploads/2017/02/zip_10MB.zip", | |
cache: false, | |
xhr: function(){ | |
var xhr = new XMLHttpRequest(); | |
xhr.responseType= 'blob'; | |
xhr.onprogress = e => console.log(`${parseInt((e.loaded/e.total)*100)}%`) | |
return xhr; | |
}, | |
success: e => console.log('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
let clickAct = [] | |
const _do = { | |
disable: () => { | |
let el = $('[onclick]'), count = el.length | |
el.each((i, e) => { | |
$(e).addClass(`click_${i}`) | |
clickAct[i] = $(e).attr('onclick') | |
if(!--count) { el.removeAttr("onclick") } | |
}) | |
}, |
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(function() { | |
$.fn.setDt = function(){ | |
this.dataTable({ | |
"paging" : true, | |
"ordering" : false, | |
"info" : true, | |
"searching" : true | |
}) | |
} | |
}); |
NewerOlder