Skip to content

Instantly share code, notes, and snippets.

@Quixomatic
Quixomatic / babel-plugin-jsx-now-pragmatic.js
Created January 13, 2023 22:49
Replacement file to make `@quixomatic/ui-renderer-react` work properly
/**
* @license
* Copyright (c) 2020 ServiceNow, Inc.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to
* deal in the Software without restriction, including without limitation the
* rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
* sell copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
@JohnAlbin
JohnAlbin / config.js
Last active May 6, 2022 16:43
Storybook navigation sorting
// .storybook/config.js
import { addParameters, configure } from '@storybook/react';
import { storySort } from 'storybook-sort';
addParameters({
options: {
showRoots: true,
storySort: storySort({ order: ['Home', 'Pages', ['Projects', 'Community', 'Help'], 'Components']}),
},
@jnerius
jnerius / OAuthGitHubHandler.js
Last active November 18, 2022 19:16
ServiceNow OAuth Handler Script Include for processing OAuth Responses from GitHub
var OAuthGitHubHandler = Class.create();
OAuthGitHubHandler.prototype = Object.extendsObject(OAuthUtil, {
// Override postprocessAccessToken method. GitHub returns a urlencoded
// body, so we need to break this apart and extract the values.
postprocessAccessToken: function(accessTokenResponse) {
var contentType = accessTokenResponse.getContentType();
var contentBody = accessTokenResponse.getBody();
var paramMap = accessTokenResponse.getparameters();
var params = contentBody.split('&');
var parts;
@paulirish
paulirish / what-forces-layout.md
Last active April 28, 2025 06:24
What forces layout/reflow. The comprehensive list.

What forces layout / reflow

All of the below properties or methods, when requested/called in JavaScript, will trigger the browser to synchronously calculate the style and layout*. This is also called reflow or layout thrashing, and is common performance bottleneck.

Generally, all APIs that synchronously provide layout metrics will trigger forced reflow / layout. Read on for additional cases and details.

Element APIs

Getting box metrics
  • elem.offsetLeft, elem.offsetTop, elem.offsetWidth, elem.offsetHeight, elem.offsetParent
@yesvods
yesvods / gist:51af798dd1e7058625f4
Created August 15, 2015 11:13
Merge Arrays in one with ES6 Array spread
const arr1 = [1,2,3]
const arr2 = [4,5,6]
const arr3 = [...arr1, ...arr2] //arr3 ==> [1,2,3,4,5,6]
@kjbrum
kjbrum / bash_profile.sh
Last active December 27, 2024 21:34
My personal bash profile
#---------------------------------------------------------------------------------------------------------------------------------------
#
# Author: Kyle Brumm
# Description: File used to hold Bash configuration, aliases, functions, completions, etc...
#
# Sections:
# 1. ENVIRONMENT SETUP
# 2. MAKE TERMINAL BETTER
# 3. FOLDER MANAGEMENT
# 4. MISC ALIAS'
@cmmartin
cmmartin / moment-filter.js
Last active July 31, 2019 09:01
A generic Moment.js date filter for Angular.js
// REQUIRES:
// moment.js - http://momentjs.com/
// USAGE:
// {{ someDate | moment: [any moment function] : [param1] : [param2] : [param n]
// EXAMPLES:
// {{ someDate | moment: 'format': 'MMM DD, YYYY' }}
// {{ someDate | moment: 'fromNow' }}
@staltz
staltz / introrx.md
Last active April 29, 2025 08:33
The introduction to Reactive Programming you've been missing
@mbenford
mbenford / demo.html
Last active September 30, 2020 16:17
Angular directive that binds attributes without relying on interpolation
<input type="text" ng-bind-attrs="{placeholder: somePropertyOfTheScope, tabindex: anotherPropertyOfTheScope}" >
@hdragomir
hdragomir / sm-annotated.html
Last active February 2, 2025 02:22
The deferred font loading logic for Smashing Magazine. http://www.smashingmagazine.com/
<script type="text/javascript">
(function () {
"use strict";
// once cached, the css file is stored on the client forever unless
// the URL below is changed. Any change will invalidate the cache
var css_href = './index_files/web-fonts.css';
// a simple event handler wrapper
function on(el, ev, callback) {
if (el.addEventListener) {
el.addEventListener(ev, callback, false);