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
/** | |
* Asynchronous function to load a module-specific configuration script, execute it, and retrieve the configuration. | |
* | |
* Requirements: | |
* - URL parameter named 'module' which specifies the module name or pass the module name as an argument. | |
* - The module name in the URL or the argument can contain dashes which will be replaced with underscores to form the variable name. | |
* - Each module-specific script should define an asynchronous configuration variable using the naming convention: | |
* 'module_name_tabulator_edit_config'. | |
* - The scripts should be located at: 'session_data.app_http_root + local/tables/tabulator-edit/{module}.tabulator.js'. | |
* |
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
select | |
concat(round(rand() * 10000), | |
round(rand() * 10000), | |
round(rand() * 10000), | |
round(rand() * 10000) | |
) as rnd | |
; |
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
This is because locale-gen is using an archive file to store all the locales, but many utilities are still looking for the locale files. | |
Have a look at /usr/lib/locale/. If your output looks like this, read on: | |
ls /usr/lib/locale/ | |
C.UTF-8 locale-archive | |
The warning isn't critical, as far as I can tell, but if it bothers you or causes troubles, try the following in a terminal window: |
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 codes_pf500 = { | |
adjust_date : Chr(61), // 3D | |
open_smetka : Chr(48), // 30 | |
close_smetka : Chr(56), // 38 | |
open_storno : Chr(85), // 55 | |
close_storno : Chr(86), // 56 | |
stavka : Chr(49), // 31 | |
vtor_red : Chr(10), // 0A | |
kraj_opis : Chr(9), // 09 |
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 | |
//-------------------------------------------------------- | |
// Example: | |
// | |
// $cars = [ | |
// ['id' => 999, 'value' =>'CARS', 'parent_id' => 0 ], | |
// ['id' => 11, 'value' =>'Toyota', 'parent_id' => 999], | |
// ['id' => 1, 'value' =>'Avalon', 'parent_id' => 11 ], | |
// ['id' => 2, 'value' =>'Corolla', 'parent_id' => 11 ], | |
// ['id' => 3, 'value' =>'Camry', 'parent_id' => 11 ], |
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 | |
/** | |
* Looks for unquoted keys in a json string and fixes them ie: {a:"b"} => {"a":"b"} | |
* @param string $string A json string that is suspect | |
* @return string A valid json string | |
*/ | |
function fix_json($string){ | |
// (no qupte) (word) (no quote) (semicolon) | |
$regex = '/(?<!")([a-zA-Z0-9_]+)(?!")(?=:)/i'; |
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 getBase64FromImageUrl(url) { | |
var img = new Image(); | |
img.setAttribute('crossOrigin', 'anonymous'); | |
img.onload = function () { | |
var canvas = document.createElement("canvas"); | |
canvas.width =this.width; | |
canvas.height =this.height; |
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
$(document).ready(function() { | |
// Function to convert an img URL to data URL | |
function getBase64FromImageUrl(url) { | |
var img = new Image(); | |
img.crossOrigin = "anonymous"; | |
img.onload = function () { | |
var canvas = document.createElement("canvas"); | |
canvas.width =this.width; | |
canvas.height =this.height; | |
var ctx = canvas.getContext("2d"); |
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 add-apt-repository ppa:sergey-dryabzhinsky/php53 | |
sudo apt-get update | |
sudo apt-get install php53-common php53-cli | |
# to see a list of available packages: | |
# apt-cache search php53 | |
# ex.: sudo apt-get install php53-mod-mysql | |
# Apache module: | |
sudo apt-get install libapache2-mod-php53 |
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
// Save a password hash: | |
// ====================== | |
$options = [ | |
'cost' => 11, | |
]; | |
// Get the password from post | |
$passwordFromPost = $_POST['password']; | |
$hash = password_hash($passwordFromPost, PASSWORD_BCRYPT, $options); |
NewerOlder