Skip to content

Instantly share code, notes, and snippets.

View AndiSHFR's full-sized avatar
💭
Designing and Coding...

Andreas Schaefer AndiSHFR

💭
Designing and Coding...
View GitHub Profile
@AndiSHFR
AndiSHFR / naturalSort.js
Created June 22, 2017 08:50
Javascript code to do a natural sort.
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];
@AndiSHFR
AndiSHFR / constants.cc
Created May 3, 2018 06:44
Node.js - add constat values to exports of native addon
#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)
@AndiSHFR
AndiSHFR / basic-jquery-widget-example.js
Created October 21, 2019 12:48
Basic jQuery Widget Example
/**
* Minimal jQuery Widget Example
* Author: Andreas Schaefer <[email protected]>
*
* Usage:
*
* <div id="myCoolWidget"></div>
*
* ...
*
@AndiSHFR
AndiSHFR / time-range.html
Created December 3, 2019 10:06
IDEA: How to handle relative time ranges in query selection parameters
<!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 -->
@AndiSHFR
AndiSHFR / script-database-users-and-permissions.sql
Last active March 8, 2020 07:46
Script Sql Server Database Users and Permissions
/**
* 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%##'