Skip to content

Instantly share code, notes, and snippets.

View EminQasimov's full-sized avatar
🎯
Focusing

Emin Gasimov EminQasimov

🎯
Focusing
View GitHub Profile
@gre
gre / easing.js
Last active June 13, 2024 12:18
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 = {
@jlong
jlong / uri.js
Created April 20, 2012 13:29
URI Parsing with Javascript
var parser = document.createElement('a');
parser.href = "http://example.com:3000/pathname/?search=test#hash";
parser.protocol; // => "http:"
parser.hostname; // => "example.com"
parser.port; // => "3000"
parser.pathname; // => "/pathname/"
parser.search; // => "?search=test"
parser.hash; // => "#hash"
parser.host; // => "example.com:3000"
@ayamflow
ayamflow / gist:b602ab436ac9f05660d9c15190f4fd7b
Created May 9, 2016 19:10
Safari border-radius + overflow: hidden + CSS transform fix
// Add on element with overflow
-webkit-mask-image: -webkit-radial-gradient(white, black);
@ahem
ahem / loadimage.js
Created October 18, 2016 12:59
Load and decode images with webworker
/* global createImageBitmap */
function loadImageWithImageTag(src) {
return new Promise((resolve, reject) => {
const img = new Image;
img.crossOrigin = '';
img.src = src;
img.onload = () => { resolve(img); };
img.onerror = () => { reject(img); };
});
@sheharyarn
sheharyarn / request.js
Last active August 24, 2023 14:55
Axios Request Wrapper for React (https://to.shyr.io/axios-requests)
/**
* Axios Request Wrapper
* ---------------------
*
* @author Sheharyar Naseer (@sheharyarn)
* @license MIT
*
*/
import axios from 'axios'
@delucis
delucis / rename-files.sh
Created May 11, 2017 19:15
Bash rename multiple files
# use string replacement to rename parts of all matching filenames
# based on http://stackoverflow.com/questions/7450818/rename-all-files-in-directory-from-filename-h-to-filename-half
for file in *.wav; do mv "$file" "${file/selection/substitution}"; done
/**
* Hypertext Transfer Protocol (HTTP) response status codes.
*
* @see {@link https://en.wikipedia.org/wiki/List_of_HTTP_status_codes}
*/
export enum HttpStatusCode {
/**
* The server has received the request headers and the client should proceed to send the request body
* (in the case of a request for which a body needs to be sent; for example, a POST request).
@EminQasimov
EminQasimov / Learning resources examples-demos
Last active January 23, 2020 13:27
Learning resources examples-demos links
#1 Pure CSS Parallax
https://keithclark.co.uk/articles/pure-css-parallax-websites/demo3/
https://keithclark.co.uk/articles/pure-css-parallax-websites/
#2 Custom element for rendering 3D models and controlling them with CSS
https://keithclark.co.uk/labs/3d-model-custom-element/examples/tests/
#3 Loading CSS without blocking render
https://keithclark.co.uk/articles/loading-css-without-blocking-render/
@bmcmahen
bmcmahen / useDeferredMount.js
Last active February 1, 2020 16:24
Deferred mounting hook
import { useState, useEffect } from 'react';
function useDeferredMount() {
const [shouldMount, setShouldMount] = useState(false);
useEffect(() => {
window.requestAnimationFrame(() => {
window.requestAnimationFrame(() => {
setShouldMount(true);
});
@markmichon
markmichon / devto.js
Created March 9, 2020 02:04
Dev.to API client example
const fetch = require("isomorphic-unfetch");
const querystring = require("querystring");
class DevTo {
constructor(config) {
this.api_key = config.api_key;
this.basePath = "https://dev.to/api";
}
request(endpoint = "", options = {}) {
let url = this.basePath + endpoint;