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
| <canvas id="myCanvas" width="600" height="400"></canvas> | |
| <style type="text/css"> | |
| canvas { | |
| background: #F9F9F9; | |
| margin: 3rem auto; | |
| display: block; | |
| } | |
| </style> | |
| <script> | |
| var point1, point2, canvas, context, fps, interval, cursorX, cursorY; |
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
| <canvas id="myCanvas" width="600" height="400"></canvas> | |
| <style type="text/css"> | |
| canvas { | |
| background: #F9F9F9; | |
| margin: 3rem auto; | |
| display: block; | |
| } | |
| </style> | |
| <script> | |
| var point1, point2, canvas, context, fps, interval, cursorX, cursorY; |
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
| // Example | |
| // Input: getCoordinatesFromSvgCoordinatesString('M0.5,0.5 L0.5,89.5 L141.5,89.5 L141.5,0.5 L0.5,0.5 Z') | |
| // Output: array like example above | |
| function getCoordinatesFromSvgCoordinatesString(svgString){ | |
| var coordinates = []; | |
| var svgParts = svgString.split(' '); | |
| var cursor = { | |
| "x": 0, | |
| "y": 0 |
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
| // import turf | |
| function bearingOnLine(feature, distance, buffer, units){ | |
| var lineDistance = turf.lineDistance(feature, units); | |
| buffer = buffer || lineDistance * 0.07; | |
| var measureFromDistance = Math.max(0, distance - buffer); | |
| var measureToDistance = Math.min(lineDistance, distance + buffer); | |
| var measureFrom = turf.along(feature, measureFromDistance, units); | |
| var measureTo = turf.along(feature, measureToDistance, units); |
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
| var turf = require('turf'); | |
| var lineString = { | |
| "type": "FeatureCollection", | |
| "features": [{ | |
| "type": "Feature", | |
| "properties": {}, | |
| "geometry": { | |
| "type": "LineString", | |
| "coordinates": [ |
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
| console.log('In which month is day #368: ', 'Month ' + (getMonthIdFromDay(368).index + 1) + ' of year ' + (getMonthIdFromDay(368).cycle + 1)); | |
| // -> In which month is day #368: Month 1 of year 2 | |
| console.log('Days in the last quarter of a year: ', getDaysPerQuarter()[3] ); | |
| // -> Days in the last quarter of a year: 92 | |
| function getMonthIdFromDay(day) { | |
| var dayRange = valuesToRange(getDaysPer('month')); | |
| return getPositionInLoopingRange(day, dayRange); | |
| } |
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
| sudo launchctl limit maxfiles 16384 16384 && ulimit -n 16384 |
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
| <a id="downloadLink" href="" download="diagram.svg">Download ↓</a> | |
| <svg id="svg" width="120" height="120"> | |
| <rect fill="#000000" x="10" y="10" width="100" height="100"></rect> | |
| </svg> | |
| <script type="text/javascript"> | |
| setDownloader('downloadLink', 'svg') | |
| function setDownloader(linkId, svgId) { | |
| // Get svg element |
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 charset="UTF-8"> | |
| <title>Camera</title> | |
| <script src="https://code.jquery.com/jquery-3.2.1.min.js" integrity="sha256-hwg4gsxgFZhOsEEamdOYGBf13FyQuiTwlAQgxVSNgt4=" crossorigin="anonymous"></script> | |
| <meta name="viewport" content="width=device-width,initial-scale=1"> | |
| <style type="text/css"> | |
| .cameraRoll { |
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 charset="UTF-8"> | |
| <title>Demo</title> | |
| <style type="text/css"> | |
| body { | |
| background-color: #ECECEC; | |
| font-family: sans-serif; |