Skip to content

Instantly share code, notes, and snippets.

diff --git a/fetch.js b/fetch.js
index f894066798bb1e429c2d2f07d1964371df58e91f..ae7d5ac0554c86203b0eaf5ba004a1ab43e818a9 100644
--- a/fetch.js
+++ b/fetch.js
@@ -2,8 +2,8 @@
Object.defineProperty(exports, '__esModule', { value: true });
-var router = require('./router.cjs');
-var types = require('./types.cjs');
@JoshBarr
JoshBarr / guessCurrentScript.js
Created June 3, 2019 05:57
Guess current script
/*
Attempt to guess which <script src=""> tag loaded the current file.
If the file was loaded as a chunk by Webpack, try and find the webpack root.
*/
function guessCurrentScript() {
var err = new Error();
Error.stackTraceLimit = 100;
var stack = err.stack;
@JoshBarr
JoshBarr / uuid.js
Created March 25, 2019 02:04
quick uuid
const cryptoLib = window.crypto || window.msCrypto;
const uuidv4 = () => {
if (!cryptoLib || !Uint8Array) {
return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, (c) => {
const r = Math.random() * 16 | 0;
const v = c === 'x' ? r : (r & 0x3 | 0x8);
return v.toString(16);
});
}
@JoshBarr
JoshBarr / reading-list.md
Last active May 28, 2021 07:42
Reading list
<style>
/* Prevent google maps from overlapping the contact form on mobile */
@media (max-width: 500px) {
#ContactUs_form > :first-child,
#page-content > :first-child {
min-width: 100% !important;
float: none;
}
}
</style>
alias g="git"
alias ga="git add"
alias gb="git branch"
alias gba="git branch -a"
alias gbd="git branch -d"
alias gbdr="git push origin --delete"
alias gc="git commit"
alias gca="git commit -a"
alias gch="git checkout"
alias gl="git log --pretty=format:'%Cred%h%Creset %s %Cgreen(%cr)%Creset %Cblue[%an]%Creset' --date=relative"
@JoshBarr
JoshBarr / curry.js
Created September 14, 2016 02:43
Butter Chicken for Javascript
const getGetRowCounts = (connection) => {
return (item) => {
return connection.query('SELECT * from foo');
};
};
// Later on..
const mapStoreToRoutes = (routes, store) => {
return routes && routes.map(route => {
return {
...route,
indexRoute: route.indexRoute && {
...route.indexRoute,
onEnter: route.indexRoute.onEnter && function mappedIndexOnEnter(nextState, replaceState, next) {
route.indexRoute.onEnter(store.dispatch, store.getState(), nextState, replaceState, next);
},
},
@JoshBarr
JoshBarr / edit.html
Created June 28, 2016 22:36
Fix enableDirtyFormCheck for safari.
{% overextends "wagtailadmin/pages/edit.html" %}
{% load i18n %}
{% load wagtailadmin_tags %}
{# Put this in core/templateswagtailadmin/pages/edit.html. Assumes overextends. #}
{% block extra_js %}
{% include "wagtailadmin/pages/_editor_js.html" %}
<script>
@JoshBarr
JoshBarr / admin.css
Last active May 30, 2016 21:49
Wagtail Admin Streamfield improvements
/* ========================================================================== *\
Wagtail Admin CSS overrides
\* ========================================================================== */
/* ------------------------------ *\
Layout: full width admin
\* ------------------------------ */
.wrapper {
max-width: 100% !important;