Skip to content

Instantly share code, notes, and snippets.

View liketaurus's full-sized avatar
📢
Trying to work and teach during the war

Alexander Babich liketaurus

📢
Trying to work and teach during the war
View GitHub Profile
@liketaurus
liketaurus / Operations.java
Last active August 31, 2019 12:54
Демонстрація дій над множинами (на основі прикладу коду з java2s.com). Створено для використання під час заняття з "Дискретної математики" на тему "Основні операції над множинами".
// Оригінальний код: https://tinyurl.com/o8ry24f
package sets;
//нам потрібні інтерфейс Set (множина) і клас TreeSet, який його реалізує
import java.util.Set;
// детальніше про TreeSet - відсортовану множину - https://www.codeflow.site/ru/article/java-tree-set
import java.util.TreeSet;
import java.util.Scanner;
@liketaurus
liketaurus / Scan.html
Created May 3, 2019 15:10
How to scan QR-code using JavaScript
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script src="https://rawgit.com/schmich/instascan-builds/master/instascan.min.js"></script>
<video id="preview" height="160" style="border: 1px solid black"></video>
<p id="results"></p>
<script type="text/javascript">
let scanner = new Instascan.Scanner({ video: document.getElementById('preview') });
scanner.addListener('scan', function (content) {
$('#results').html(content);
});
@liketaurus
liketaurus / Gen.html
Created May 3, 2019 15:09
How to generate QR-code using JavaScript
<div>
<input type="text" id="textToQR" />
<button id="GenQR" onclick="makeCode();">Generate QR from text</button>
</div>
<br>
<div id="qrcode" style="width:160px; height:160px; margin-top:15px;"></div>
<script src="https://code.jquery.com/jquery-3.4.1.js"></script>
<script src="qrcode.min.js"></script>
@liketaurus
liketaurus / function.json
Last active May 1, 2019 17:59
Azure Function to get a number from a Fibonacci sequence. Sample usage: https://functionName.azurewebsites.net/fibonacci?index=14
{
"bindings": [
{
"authLevel": "anonymous",
"name": "req",
"type": "httpTrigger",
"direction": "in",
"methods": [
"get",
"post"
@liketaurus
liketaurus / divOnDiv.html
Last active November 22, 2018 07:15
How to place one div on top of another - 'position' and 'z-order' game (based on jsbin.com/edejus/1)
<!DOCTYPE html>
<html lang="en" xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta charset="utf-8" />
<title>Div on Div</title>
<style>
#box {
width: 428px;
height: 200px;
@liketaurus
liketaurus / Playlists.html
Created August 23, 2018 13:30
How to embed Youtube playlist
<h3>Курс JAVA Professional</h3>
<br />
<iframe width="100%" height="900" src="https://www.youtube.com/playlist?list=PLvItDmb0sZw9DXLBDs4IBcalvA1Nx56o9"
frameborder="0"
allowfullscreen>
</iframe>
@liketaurus
liketaurus / GD-Folder.html
Created August 23, 2018 13:28
How to embed Google Drive folder
<h3>Вебінари з DevOps</h3>
<iframe src="https://drive.google.com/embeddedfolderview?id=1k42zzrPmEw0wBAHsGKF6thCzDz4c8vyG#grid"
style="width:100%; height:500px; border:0;">
</iframe>
@liketaurus
liketaurus / myIP.js
Last active May 12, 2018 06:55
How to get local IP address via JavaScript
// found at https://stackoverflow.com/a/32841043
// many thanks to author!
window.RTCPeerConnection = window.RTCPeerConnection || window.mozRTCPeerConnection || window.webkitRTCPeerConnection;
// Firefox & Chrome only! This will not work in Edge!
var pc = new RTCPeerConnection({iceServers:[]}), noop = function(){};
pc.createDataChannel('');//create a bogus data channel
pc.createOffer(pc.setLocalDescription.bind(pc), noop);// create offer and set local description
pc.onicecandidate = function(ice) {
@liketaurus
liketaurus / GetLocation.cs
Created October 26, 2017 16:01
How to use Bing Maps geocode REST services
// Legacy Bing geocoding SOAP services were recent shut down after being replaced by the REST services
// so, you need to migrate your app to use the REST services.
//
// If your application uses .NET you will likely find this library useful:
// 'Bing Maps REST Services Toolkit' - https://github.com/Microsoft/BingMapsRESTToolkit
//
// Just install NuGet package named 'BingMapsRESTToolkit'!
// Don't forget to add namespace BingMapsRESTToolkit to your using block!
//
// Now you can get the coordinates of any address by calling the following method
@liketaurus
liketaurus / URLDisplayerDemo.java
Last active April 22, 2017 16:11
How open specified URL from Java code (fragment of Netbeans plugin code)
// ...
@Override
public void actionPerformed(ActionEvent e) {
// TODO implement action body
try {
URLDisplayer.getDefault().showURL(new URL("http://productivityblog.com.ua"));
} catch (MalformedURLException ex) {
JOptionPane.showMessageDialog(null, "Can't open an URL: " + ex.getMessage());
}