Skip to content

Instantly share code, notes, and snippets.

View creage's full-sized avatar

Aziz Gazanchiyan creage

View GitHub Profile
@creage
creage / ntlm-proxy.js
Created October 12, 2020 10:56
NTLM proxy wrapper around cypress-ntlm-auth
const axios = require('axios');
const ntlmAuth = require('cypress-ntlm-auth/dist/plugin');
const ConfigValidator = require('cypress-ntlm-auth/dist/util/config.validator').ConfigValidator;
const SsoConfigValidator = require('cypress-ntlm-auth/dist/util/sso.config.validator').SsoConfigValidator;
const DI = require('cypress-ntlm-auth/dist/proxy/dependency.injection');
const DITypes = require('cypress-ntlm-auth/dist/proxy/dependency.injection.types');
module.exports = class NTLMProxy {
@creage
creage / $.format
Created April 25, 2014 20:45
$.format
(function ($, window, document, undefined) {
$.extend({
/**
* Format at string using .NET C# syntax
$.format("test {0} and {1}", "is cool", "and passed");
$.format("test {1} and {0}", ["is cool", "and passed"]);
*/
format: (function () {
var iterate = function (txt, replacements) {
@creage
creage / $.wait
Created April 25, 2014 20:44
$.wait
(function ($, window, document, undefined) {
$.extend({
/*
* wait for timeout until condition returns true
*/
wait: function (conditionCallback, timeout) {
timeout = timeout || 50;
return $.Deferred(function (dfd) {
@creage
creage / $.eachDeferred
Created April 25, 2014 20:43
$.eachDeferred
(function ($, window, document, undefined) {
$.extend({
/*
* Iterates over elms array/collection using deferred callbacks.
* the function assigned for iterator should return promise.
* resolved promises notify the main deferred, so we can track each loop result.
* returns promise.
*/
eachDeferred: function (elms, c) {
@creage
creage / eachDeferred
Created April 25, 2014 20:41
jQuery.eachDeferred
(function ($, window, document, undefined) {
$.fn.extend({
/*
* Iterates over jQuery object collection using deferred callbacks.
* the function assigned for iterator should return promise.
* resolved promises notify the main deferred, so we can track each loop result.
* returns promise.
*/
eachDeferred: function (c) {
var that = this,
@creage
creage / :detached
Created April 25, 2014 20:38
jQuery :detached selector
$.extend($.expr[':'], {
/*
* check if element is detached from DOM
*/
detached: function (elem) {
return !$.contains(document.documentElement, elem);
}
});
@creage
creage / windowresize
Created April 25, 2014 20:37
jquery's bounced on('windowresize')
(function ($) {
// Special event definition.
$.event.special.windowresize = {
setup: function () {
$(this).ondelay('resize', { timeout: 300 }, resizeHandler);
},
teardown: function () {
$(this).off('resize', resizeHandler);
}
@creage
creage / ondelay
Last active August 29, 2015 14:00
jQuery.ondelay
(function ($, window, document, undefined) {
$.fn.extend({
/*
* Provides event handling with delaying ability
* respects two attributes coming as data attributes:
* timeout: integer value of ms to timeout before event will be triggered once event is stopped to be fired
* throttle: boolean, default false
* if set to true - event will be fired once per timeout,
* if set to false - event will be fired only after timeout starting from event is stoped firing
*/