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 / DatepickerSpan.html
Last active December 17, 2015 07:29
How to display jQuery's Datepicker in specified position when user clicks on a text span element
<span class="float_right" id="clock"
onclick="$('#clock').datepicker('dialog', '', function () {}, {showButtonPanel: true}, [$(window).width() - 209, 27]);">
</span>
@liketaurus
liketaurus / KyivTemperature.js
Last active December 17, 2015 07:29
How to get current temperature with jQuery and Global Weather web service
var weather = $('#weather');
var city = "Kyiv";
var country = "Ukraine";
var temp;
$.ajax({
type: "GET",
url: "http://www.webservicex.net//globalweather.asmx/GetWeather?CityName=" + city + "&CountryName=" + country + "",
dataType: "xml",
success: function (xml) {
@liketaurus
liketaurus / weatherForecast.html
Last active December 17, 2015 16:18
How to get Weather Forecast with jQuery Dialog and forecast.io
//Read more here: http://blog.forecast.io/forecast-embeds/
<div id="dialog-message" title="Current Weather" style="display:none">
<iframe id="forecast_embed" frameborder="0" height="245" style="width:100%"
src="http://forecast.io/embed/#lat=50.450100&lon=30.523400&name=Kyiv&units=uk">
</iframe>
</div>
...
@liketaurus
liketaurus / ClockWidget.html
Last active December 18, 2015 09:40
How to add draggable analog clock widget with jQuery and clocktag.com
<div id="clockW">
<iframe id="clockobj" style="border:0;margin:0;padding:0;width:100px;height:100px;"
src="http://www.clocktag.com/html5/m121.html"></iframe>
<center><p>...</p></center>
</div>
...
<script>
...
@liketaurus
liketaurus / jQM_Chrome.js
Last active March 12, 2016 08:09
Getting jQuery Mobile to work in packed Chrome app
//to avoid "Uncaught SecurityError: Failed to execute 'replaceState' on 'History'" in Chrome app (local file)
//just comment out the following line in jQuery Mobile
window.history.replaceState( state, state.title || document.title, href );
//that the bad and ugly solution, but it works:-)
//adding "-allow-file-access-from-files" as Chrome command line argument is not a case for me
@liketaurus
liketaurus / iframe_part.html
Created March 15, 2016 11:06
How to embed in iframe just one part of web page based on id or location
<!DOCTYPE html>
<html lang="en">
<head>
<title>Comm</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.0/jquery.min.js"></script>
<script src="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js"></script>
@liketaurus
liketaurus / CaesarsCipher.js
Created March 18, 2016 13:55
JavaScript function that takes a ROT13 encoded string and decodes it
function rot13(str) {
var result="";
var rot=13;
var s=(26-rot)%26; //s=rot; if you want to encrypt!
for (var i=0;i<str.length;i++)
{
var c = str.charCodeAt(i);
if (c>=65 && c<=90)
result=result+String.fromCharCode((c-65+s)%26+65);
else
@liketaurus
liketaurus / rabota-ua-api-demo.markdown
Last active June 26, 2020 19:31
rabota.ua API demo

rabota.ua API demo

Just a simple demo for getting JSON data from one of the biggest Ukrainian job searching sites.

Company ID was selected randomly - just for demonstration purposes.

You can play with this code in live environment at CodePen

License.

@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());
}
@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