Skip to content

Instantly share code, notes, and snippets.

View DragorWW's full-sized avatar

Andreev Sergey DragorWW

View GitHub Profile

Everything I Know About UI Routing

Definitions

  1. Location - The location of the application. Usually just a URL, but the location can contain multiple pieces of information that can be used by an app
    1. pathname - The "file/directory" portion of the URL, like invoices/123
    2. search - The stuff after ? in a URL like /assignments?showGrades=1.
    3. query - A parsed version of search, usually an object but not a standard browser feature.
    4. hash - The # portion of the URL. This is not available to servers in request.url so its client only. By default it means which part of the page the user should be scrolled to, but developers use it for various things.
    5. state - Object associated with a location. Think of it like a hidden URL query. It's state you want to keep with a specific location, but you don't want it to be visible in the URL.
interface AliasFn<Subject> {
(): Cypress.Chainable<Subject>
alias: string
}
declare namespace Cypress {
interface Chainable<Subject> {
createAlias(): AliasFn<Subject>
getAliases<T1, T2, T3, T4>(values: [AliasFn<T1>, AliasFn<T2>, AliasFn<T3>, AliasFn<T4>]): Chainable<[T1, T2, T3, T4]>
@0x263b
0x263b / colors.md
Last active March 7, 2024 10:09
Random color from string in javascript

Random color from string in javascript

Consider a list of strings you need to permanently assign a random color.

First you should turn the string into a hash.

var string = "string"
var hash = 0
@gre
gre / easing.js
Last active April 30, 2024 04:58
Simple Easing Functions in Javascript - see https://github.com/gre/bezier-easing
/*
* This work is free. You can redistribute it and/or modify it under the
* terms of the Do What The Fuck You Want To Public License, Version 2,
* as published by Sam Hocevar. See the COPYING file for more details.
*/
/*
* Easing Functions - inspired from http://gizma.com/easing/
* only considering the t value for the range [0, 1] => [0, 1]
*/
EasingFunctions = {
@tlync
tlync / jquery-doubletap.js
Created June 9, 2011 03:45
jquery double tap plugin - Bind an event handler to the "double tap" JavaScript event.
(function($){
var hasTouch = /android|iphone|ipad/i.test(navigator.userAgent.toLowerCase()),
eventName = hasTouch ? 'touchend' : 'click';
/**
* Bind an event handler to the "double tap" JavaScript event.
* @param {function} doubleTapHandler
* @param {number} [delay=300]
*/