Skip to content

Instantly share code, notes, and snippets.

View audunolsen's full-sized avatar
🌷
Made a new avatar with Midjourney lmao

Audun Meek Olsen audunolsen

🌷
Made a new avatar with Midjourney lmao
View GitHub Profile
@wojtekmaj
wojtekmaj / merge-refs.js
Last active August 16, 2024 02:21
Merge multiple React refs to use them on a single React element.
/**
* Allows to use multiple refs on a single React element.
* Supports both functions and ref objects created using createRef() and useRef().
*
* Usage:
* ```jsx
* <div ref={mergeRefs(ref1, ref2, ref3)} />
* ```
*
* @param {...Array<Function|Object>} inputRefs Array of refs
@felipenmoura
felipenmoura / animatedScrollTo.js
Last active November 6, 2024 22:54 — forked from joshbeckman/animatedScrollTo.js
ScrollTo animation using pure javascript and no jquery
/**
* Will gracefuly scroll the page
* This function will scroll the page using
* an `ease-in-out` effect.
*
* You can use it to scroll to a given element, as well.
* To do so, pass the element instead of a number as the position.
* Optionally, you can pass a `queryString` for an element selector.
*
* The default duration is half a second (500ms)
@MosheBerman
MosheBerman / hash.py
Last active June 20, 2018 08:40
A Python script to hash domain names.
import hashlib
import sys
try:
website_name = sys.argv[1]
hash_value = hashlib.md5(website_name)
print(hash_value.hexdigest().upper() + ".png")
except Exception, e:
@lunelson
lunelson / SassMeister-input.scss
Last active August 27, 2021 11:21
Sass reset mixin, for resetting elements
// ----
// Sass (v3.3.14)
// Compass (v1.0.3)
// ----
@mixin reset($type){
$resets: (
ul: (
list-style: none,
margin: 0,
@mdasberg
mdasberg / pre-and-post-grunt-hook.js
Last active March 8, 2019 15:13
Pre-execution and post-execution "hooks" for Grunt
var grunt = require('grunt');
var hooker = require('hooker');
module.exports = preAndPostHook = function () {
var currentTask = undefined;
/**
* Do something when the task has sta.
* @param taskName The task name.
*/
@branneman
branneman / app.js
Last active February 5, 2021 21:58
Node.js application entry-point files
#!/usr/bin/env node
'use strict';
var spawn = require('child_process').spawn;
var args = [
'--harmony',
'app/bootstrap.js'
];
@eriwen
eriwen / cors.js
Created May 26, 2012 15:54
Simple cross-domain Javascript function
/**
* Make a X-Domain request to url and callback.
*
* @param url {String}
* @param method {String} HTTP verb ('GET', 'POST', 'DELETE', etc.)
* @param data {String} request body
* @param callback {Function} to callback on completion
* @param errback {Function} to callback on error
*/
function xdr(url, method, data, callback, errback) {