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
/** | |
* To use this module simply run: | |
* ~~~{.sh} | |
* node pack_file.js | |
* ~~~ | |
*/ | |
const fs = require('fs'); | |
const zlib = require('zlib'); |
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
#!/bin/zsh | |
android_abi=armeabi-v7a | |
android_platform=android-19 | |
path_to_cmakelists=~/Documents/dev/src/smartplatform-CMake | |
path_to_generated=~/Documents/dev/src/build | |
path_to_ndk=~/Library/Android/sdk/ndk/24.0.8215888 | |
path_to_ninja=/usr/local/bin/ninja |
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
#include <cstdlib> | |
#include <cstdio> | |
#include <thread> | |
#include <string> | |
#include <chrono> | |
#include <atomic> | |
#include <pthread.h> | |
class ScopeTimer { |
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
/** | |
* Copyright (c) 2021 Vladimir Sviridov. | |
* Distributed under the MIT License (license terms are at http://opensource.org/licenses/MIT). | |
* | |
* Module defines LRU cache class. | |
*/ | |
/** | |
* Defines LRU cache | |
* |
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
import 'package:flutter/material.dart'; | |
/// Custom appbar with custom paddings and height | |
class MyCustomAppBar extends StatelessWidget implements PreferredSizeWidget { | |
final double _height; | |
final Widget Function(BuildContext context) _builder; | |
/// Builds custom app bar with [height] and [builder]. | |
const MyCustomAppBar({ | |
Key key, |
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
import 'dart:async'; | |
Future<String> someFutureResult(){ | |
final c = new Completer<String>(); | |
// complete will be called in 3 seconds by the timer. | |
new Timer(Duration(seconds: 3), () => c.complete("you should see me second")); | |
return c.future; | |
} | |
main(){ |
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
getObjectRows : function(array) { | |
if (!Array.isArray(array)) | |
return new Array(); | |
if (array.length == 0) | |
return new Array(); | |
var rows = new Array(); | |
var namesRow = new Array(); | |
var obj = array[0]; | |
for (var prop in obj) { | |
if (obj.hasOwnProperty(prop) && typeof obj[prop] !== "function" && typeof obj[prop] !== "object") { |
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
function download(content, fileName, contentType) { | |
var a = document.createElement("a"); | |
var file = new Blob([content], {type: contentType}); | |
a.href = URL.createObjectURL(file); | |
a.download = fileName; | |
a.click(); | |
URL.revokeObjectURL(a.href); | |
} | |
// Usage | |
var jsonObject = { |
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
window.addEventListener('beforeunload', function (e) { | |
sendAnalyticsData(); | |
}); | |
function sendAnalyticsData() { | |
if (navigator && navigator.sendBeacon) { | |
navigator.sendBeacon(url); | |
} else { | |
$.ajax({ | |
type: 'POST', |
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
/** | |
* Module describes classes ActionPromise and ActionPromiseList. | |
* Exceptionally useful when your executed code has asynchronous dependencies. | |
* Keeps the same execution order as promises have been added despite the server response. | |
* | |
* Here's an example of code: | |
* @code{.js} | |
* needAddress = true; | |
* needGeometry = true; | |
* requestAddress(function(){ |
NewerOlder