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
/** | |
* script-database-users-and-permissions.sql | |
* | |
* Copyright (C) 2020 by Andreas Schaefer <[email protected]> | |
* | |
* Create a t-sql script that can be used to restore users and | |
* persmissions on a sql server database | |
* | |
* Notes: | |
* - The script will not script built-in accounts or accounts like '##MS%##' |
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
<!DOCTYPE html> | |
<!-- | |
IDEA: How to handle relative time ranges in query selection parameters | |
--> | |
<html lang="en"> | |
<head> | |
<meta charset="utf-8"> | |
<meta http-equiv="X-UA-Compatible" content="IE=edge"> | |
<meta name="viewport" content="width=device-width, initial-scale=1"> | |
<!-- The above 3 meta tags *must* come first in the head; any other head content must come *after* these tags --> |
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
/** | |
* Minimal jQuery Widget Example | |
* Author: Andreas Schaefer <[email protected]> | |
* | |
* Usage: | |
* | |
* <div id="myCoolWidget"></div> | |
* | |
* ... | |
* |
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
#define NODE_SET_MEMBER(target, name, value) \ | |
do { \ | |
v8::Isolate* isolate = target->GetIsolate(); \ | |
v8::Local<v8::Context> context = isolate->GetCurrentContext(); \ | |
v8::Local<v8::String> constant_name = v8::String::NewFromUtf8(isolate, (name)); \ | |
(target)->Set(v8::Local<Value>::New(isolate, \ | |
v8::String::NewFromUtf8(isolate, name)), \ | |
value); \ | |
} while (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
function naturalSort(ar, index){ | |
var L= ar.length, i, who, next, | |
isi= typeof index== 'number', | |
rx= /(\.\d+)|(\d+(\.\d+)?)|([^\d.]+)|(\.(\D+|$))/g; | |
function nSort(aa, bb){ | |
var a= aa[0], b= bb[0], a1, b1, i= 0, n, L= a.length; | |
while(i<L){ | |
if(!b[i]) return 1; | |
a1= a[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
!function() { | |
function _dynamicSortMultiple(attr) { | |
/* | |
* save the arguments object as it will be overwritten | |
* note that arguments object is an array-like object | |
* consisting of the names of the properties to sort by | |
*/ | |
var props = arguments; | |
return function (obj1, obj2) { |
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
{ | |
"FormattingOptions": { | |
"NewLine": "\n", | |
"UseTabs": false, | |
"TabSize": 2, | |
"IndentationSize": 2, | |
"SpacingAfterMethodDeclarationName": false, | |
"SpaceWithinMethodDeclarationParenthesis": false, | |
"SpaceBetweenEmptyMethodDeclarationParentheses": false, | |
"SpaceAfterMethodCallName": false, |
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
-- This sql snippet converts a base2 string (0 and 1 bits) | |
-- into an integer value | |
DECLARE @bitmask VARCHAR(8) = '10000000' | |
-- Bitposition: 76543210 | |
DECLARE @intValue INT | |
;WITH bits(pos) AS ( | |
select 1 union select 2 union select 3 union select 4 union |
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
-- Pageing in SQL Server like mysql (LIMIT + OFFSET) | |
DECLARE @Offset INT = 3 | |
DECLARE @Limit INT = 10 | |
;WITH Results_CTE AS | |
( | |
SELECT | |
COUNT(*) OVER () as TotalRows, | |
ROW_NUMBER() OVER (ORDER BY name) AS RowNum, | |
id, name, crdate, refdate |
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
<?php | |
// Protect agains direct calls from the web browser | |
if(1 == count(get_included_files())) { | |
http_response_code(404); | |
die( '<h1>404 Not Found</h1><p>The page that you have requested could not be found.</p>'); | |
} | |
// More library code here |
NewerOlder