In the root of your project, add .gitlab-ci.yml
with the configuration below.
image: node:latest
stages:
import { lazy } from 'react'; | |
const lazyWithRetry = (componentImport) => | |
lazy(async () => { | |
const pageHasAlreadyBeenForceRefreshed = JSON.parse( | |
window.localStorage.getItem( | |
'page-has-been-force-refreshed' | |
) || 'false' | |
); |
import { useState } from "react"; | |
export function useLocalStorage<T>(key: string, initialValue: T): [T, (s: T) => void] { | |
// State to store our value | |
// Pass initial state function to useState so logic is only executed once | |
const [storedValue, setStoredValue] = useState<T>(() => { | |
try { | |
// Get from local storage by key | |
const item = window.localStorage.getItem(key); | |
// Parse stored json or if none return initialValue |
function sortObject(object) { | |
//Thanks > http://whitfin.io/sorting-object-recursively-node-jsjavascript/ | |
if (!object) { | |
return object; | |
} | |
const isArray = object instanceof Array; | |
var sortedObj = {}; | |
if (isArray) { | |
sortedObj = object.map((item) => sortObject(item)); |
import requests | |
from requests.auth import HTTPBasicAuth | |
import re | |
from StringIO import StringIO | |
import uuid | |
# Inspired from https://gist.github.com/toudi/67d775066334dc024c24 | |
# Tested on Jira 7.4 and Gitlab 2.2 with Python 2.7 | |
JIRA_URL = 'https://your-jira-url.tld/' | |
JIRA_ACCOUNT = ('jira-username', 'jira-password') |
#!/bin/sh | |
########### | |
# basic # | |
########### | |
# homebrew | |
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" | |
brew tap caskroom/versions |
https://gist.github.com/ljharb/58faf1cfcb4e6808f74aae4ef7944cff
While attempting to explain JavaScript's reduce
method on arrays, conceptually, I came up with the following - hopefully it's helpful; happy to tweak it if anyone has suggestions.
JavaScript Arrays have lots of built in methods on their prototype. Some of them mutate - ie, they change the underlying array in-place. Luckily, most of them do not - they instead return an entirely distinct array. Since arrays are conceptually a contiguous list of items, it helps code clarity and maintainability a lot to be able to operate on them in a "functional" way. (I'll also insist on referring to an array as a "list" - although in some languages, List
is a native data type, in JS and this post, I'm referring to the concept. Everywhere I use the word "list" you can assume I'm talking about a JS Array) This means, to perform a single operation on the list as a whole ("atomically"), and to return a new list - thus making it mu
// _decimal.scss | MIT License | gist.github.com/terkel/4373420 | |
// Round a number to specified digits. | |
// | |
// @param {Number} $number A number to round | |
// @param {Number} [$digits:0] Digits to output | |
// @param {String} [$mode:round] (round|ceil|floor) How to round a number | |
// @return {Number} A rounded number | |
// @example | |
// decimal-round(0.333) => 0 |
As pointed out by @johntyree in the comments, using git reflog is easier and more reliable. Thanks for the suggestion!
$ git reflog
1ed7510 HEAD@{1}: checkout: moving from develop to 1ed7510
3970d09 HEAD@{2}: checkout: moving from b-fix-build to develop
1ed7510 HEAD@{3}: commit: got everything working the way I want
70b3696 HEAD@{4}: commit: upgrade rails, do some refactoring