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 details = document.getElementById("details"); | |
// Feature detection | |
if (window.AmbientLightSensor){ | |
try{ | |
const sensor = new AmbientLightSensor(); | |
// Detect changes in the light | |
sensor.onreading = () => { | |
details.innerHTML = sensor.illuminance; |
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 cacheName = 'blogCache'; | |
const offlineUrl = '/offline/'; | |
self.addEventListener('install', event => { | |
event.waitUntil( | |
caches.open(cacheName) | |
.then(cache => cache.addAll([ | |
'./assets/font/icons.woff2', | |
'./assets/js/script.js', | |
'https://fonts.googleapis.com/css?family=Open+Sans:400,700', |
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
for (int i = 0; i < ListLoop.Count; i++) | |
{ | |
if (populatedList\[i\] == "Test2500") | |
{ | |
return; | |
} | |
} |
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
foreach (string findString in populatedList) | |
{ | |
if (findString == "Test2500") | |
{ | |
return; | |
} | |
} |
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
/// <summary> | |
/// Loops through the loop until it reaches a count of 3000 | |
/// </summary> | |
public void ForLoop() | |
{ | |
List<string\> list = new List<string>(); | |
for (int i = 0; i < 3000; i++) | |
{ | |
list.Add("Test" \+ i); |
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
/// <summary> | |
/// Loops through the list until it | |
/// reaches a count of 3000. | |
/// </summary> | |
public void WhileLoop() | |
{ | |
List<string\> list = new List<string>(); | |
int x = 0; |
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
/// <summary> | |
/// Draws the map. | |
/// </summary> | |
/// <param name="helper">The helper.</param> | |
/// <param name="key">The key.</param> | |
/// <param name="jsonUrl">The json URL.</param> | |
/// <param name="mapWidth">Width of the map.</param> | |
/// <param name="mapHeight">Height of the map.</param> | |
/// <returns>The html of the map.</returns> | |
public static string DrawMap(this HtmlHelper helper, string key, string jsonUrl, string mapWidth, string mapHeight) |
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
public ActionResult GetMarkers() | |
{ | |
// This would normally be our call to the Db, | |
// else we could populate this | |
// with some data as Ive done here. | |
MarkerList markers = GetMarkersObjects(); | |
return Json(markers, JsonRequestBehavior.AllowGet); | |
} |
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
if ('serviceWorker' in navigator) { | |
caches.keys().then(function(cacheNames) { | |
cacheNames.forEach(function(cacheName) { | |
caches.delete(cacheName); | |
}); | |
}); | |
} |
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
if ('storage' in navigator && 'estimate' in navigator.storage) { | |
navigator.storage.estimate().then(estimate => { | |
console.log(`Using ${estimate.usage} out of ${estimate.quota} bytes.`); | |
}); | |
} |
NewerOlder