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 solution for https://leetcode.com/problems/sudoku-solver/ | |
type Cache struct { | |
row [9][9]bool | |
column [9][9]bool | |
box [9][9]bool | |
} | |
var oneCode = "1"[0] | |
var dotCode = "."[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
/** | |
* Renders an offline audio context into an audio buffer. | |
* Considers timeout and suspension. | |
* | |
* The `context` argument is an instance of OfflineAudioContext. | |
*/ | |
function renderAudio(context) { | |
return new Promise((resolve, reject) => { | |
context.oncomplete = (event) => resolve(event.renderedBuffer) |
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
/* | |
Setup for using only Babel. It produces a file which require()s Babel helpers (ok for Node.js environment). | |
NPM dependencies (check the output file to know which of them are really required): | |
core-js ^3 | |
@babel/runtime ^7.4 | |
NPM dev-dependencies: | |
@babel/core ^7.4 | |
@babel/plugin-transform-runtime ^7.4 |
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
<?php | |
/** | |
* Compares 2 arrays. Detects what needs to be removed from and added to the first array to turn it to the second array. | |
* | |
* @param array $array1 | |
* @param array $array2 | |
* @param callable|null $areEqual Detects whether two array elements are equal. The first argument is a first array | |
* value, the second argument is a second array value. | |
* @return array[] An array with keys: |
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
<?php | |
// Add this method to your test class | |
/** | |
* Asserts that the given callback throws the given exception. | |
* | |
* @param string $expectClass The name of the expected exception class | |
* @param callable $callback A callback which should throw the exception | |
* @param callable|null $onException A function to call after exception check. It may be used to test the exception. |
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($) { | |
var IMAGE_MIRROR_CLASSES = ['fr-dii', 'fr-fil', 'fr-fir', 'fr-dib']; | |
var IMAGE_MIRROR_STYLES = ['width']; | |
$.FroalaEditor.DEFAULTS = $.extend($.FroalaEditor.DEFAULTS, { | |
imageCaptionFigureAll: false | |
}); | |
$.FroalaEditor.PLUGINS.imageCaption = function(editor) | |
{ |
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(window) { | |
var isit; | |
var init_callbacks = new Array(); | |
var base = is_secure() ? 'https://widget.bnovo.ru' : 'http://widget.bnovo.ru'; | |
function is_local() { | |
return window._bnovo_local_; | |
} | |
function local_host() { |
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
<?php | |
$cache = new Cache(); // A cache implementation | |
/* Basic usage */ | |
/* | |
This method returns a cached value. | |
If the value needs to be recalculated, the function from the second argument is called. | |
The $cache object makes this function not to be called too often in any race conditions by setting locks, updating before expiration or any other method. |