This file contains hidden or 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="minimal-ui" /> | |
| <title>Google Map and Kendo UI</title> | |
| <link href="http://cdn.kendostatic.com/2014.1.318/styles/kendo.mobile.all.min.css" rel="stylesheet" /> | |
| <script src="http://cdn.kendostatic.com/2014.1.318/js/jquery.min.js"></script> | |
| <script src="http://cdn.kendostatic.com/2014.1.318/js/kendo.mobile.min.js"></script> | |
| <script src="http://maps.googleapis.com/maps/api/js?sensor=true"></script> | |
| <style id="jsbin-css"> |
This file contains hidden or 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 fromWKT2Json(WKTstr) { | |
| var mods = {}; | |
| var convertToPointArray = function (ptArrayString) { | |
| var points = [], | |
| ptStringArray = ptArrayString.replace(/\)|\(/gi, "").split(","); | |
| ptStringArray.forEach(function (pt) { | |
| var splitpt = pt.trim().split(" "), | |
| x = parseFloat(splitpt[0], 10), | |
| y = parseFloat(splitpt[1], 10); |
This file contains hidden or 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 ng-app="Demo"> | |
| <head> | |
| <meta charset="utf-8" /> | |
| <title> | |
| Scope $watch() vs. $watchCollection() In AngularJS | |
| </title> | |
| <style type="text/css"> |
This file contains hidden or 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
| // extension for jQuery | |
| (function (root) { | |
| if (root.Enumerable == null) { | |
| throw new Error("can't find Enumerable. linq.jquery.js must load after linq.js"); | |
| } | |
| if (root.jQuery == null) { | |
| throw new Error("can't find jQuery. linq.jquery.js must load after jQuery"); | |
| } |
This file contains hidden or 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 currentTimezoneOffset() { | |
| var dstPeriod = { | |
| 2012: [new Date(2012, 2, 11), new Date(2012, 10, 4)], | |
| 2013: [new Date(2013, 2, 10), new Date(2013, 10, 3)], | |
| 2014: [new Date(2014, 2, 9), new Date(2014, 10, 2)], | |
| 2015: [new Date(2015, 2, 8), new Date(2015, 10, 1)], | |
| 2016: [new Date(2016, 2, 13), new Date(2016, 10, 6)], | |
| 2017: [new Date(2017, 2, 12), new Date(2017, 10, 5)], | |
| 2018: [new Date(2018, 2, 11), new Date(2018, 10, 4)], | |
| 2019: [new Date(2019, 2, 10), new Date(2019, 10, 3)], |
This file contains hidden or 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
| // Getting a file through XMLHttpRequest as an arraybuffer and creating a Blob | |
| var rhinoStorage = localStorage.getItem("rhino"), | |
| rhino = document.getElementById("rhino"); | |
| if (rhinoStorage) { | |
| // Reuse existing Data URL from localStorage | |
| rhino.setAttribute("src", rhinoStorage); | |
| } | |
| else { | |
| // Create XHR and FileReader objects | |
| var xhr = new XMLHttpRequest(), |
This file contains hidden or 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
| // Getting a file through XMLHttpRequest as an arraybuffer and creating a Blob | |
| var rhinoStorage = localStorage.getItem("rhino"), | |
| rhino = document.getElementById("rhino"); | |
| if (rhinoStorage) { | |
| // Reuse existing Data URL from localStorage | |
| rhino.setAttribute("src", rhinoStorage); | |
| } | |
| else { | |
| // Create XHR, Blob and FileReader objects | |
| var xhr = new XMLHttpRequest(), |
This file contains hidden or 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
| // localStorage with image | |
| var storageFiles = JSON.parse(localStorage.getItem("storageFiles")) || {}, | |
| elephant = document.getElementById("elephant"), | |
| storageFilesDate = storageFiles.date, | |
| date = new Date(), | |
| todaysDate = (date.getMonth() + 1).toString() + date.getDate().toString(); | |
| // Compare date and create localStorage if it's not existing/too old | |
| if (typeof storageFilesDate === "undefined" || storageFilesDate < todaysDate) { | |
| // Take action when the image has loaded |
This file contains hidden or 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
| // Converts an ArrayBuffer directly to base64, without any intermediate 'convert to string then | |
| // use window.btoa' step. According to my tests, this appears to be a faster approach: | |
| // http://jsperf.com/encoding-xhr-image-data/5 | |
| /* | |
| MIT LICENSE | |
| Copyright 2011 Jon Leighton | |
| Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: |