Discover gists
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import app from '../../../app'; | |
import apiHelpers from '@/server/api/tests/apiHelpers'; | |
const request = require('supertest'); | |
const tokenValue = apiHelpers.createToken('anotheruser@expressen.se'); | |
export const httpRequest = type => (endpoint, includeAuthenCookie = true) => argsObj => { | |
const req = request(app)[type](endpoint); | |
if (includeAuthenCookie) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export const CANCEL_REJECTION = 'CANCEL_REJECTION'; | |
export default function createPromiseCanceller() { | |
let racesInProgress; | |
let promiseRejector; | |
let racePromise; | |
function resetCanceller() { | |
racesInProgress = 0; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const puppeteer = require('puppeteer'); | |
(async () => { | |
const browser = await puppeteer.launch({ args: ['--no-sandbox', '--disable-setuid-sandbox'] }); | |
const page = await browser.newPage(); | |
await page.goto('https://website.com', { waitUntil: 'networkidle0', timeout: 60000 }); | |
await page.setViewport({ width: 1920, height: 1080 }); | |
await page.screenshot({ path: 'website.png', fullPage: true }); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
custom container | |
::: section header | |
# header | |
content | |
::: | |
oc -n bn-klara-goran2-prod describe pod goran2-7fd8fc7f47-pptll |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const storage = require('azure-storage'); | |
const memoizeOne = require('memoize-one'); | |
const streams = require('memory-streams'); | |
const csvtojsonV2 = require('csvtojson'); | |
const Json2csvParser = require('json2csv').Parser; | |
const getFileService = memoizeOne(conn => storage.createFileService(conn)); | |
const getFiles = (conn, map) => | |
new Promise((resolve, reject) => { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- Research has shown that the ideal line length is about 65 characters. Anywhere between 45 and 85 is generally seen as acceptable, in the context of a roman alphabet. | |
- You may have heard that using the wildcard selector (*) is bad practice. Some will tell you that it is slow, and can affect the overall performance of your page. | |
Happily, this is not true. It's been debunked again and again. Even in 2009, when computers were slower and browsers were less optimized, this wasn't an issue. Performance concerns around the wildcard selector are a particularly-resilient urban legend. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const { | |
get, | |
getOr, | |
pipe, | |
map, | |
flatMap, | |
toPairs, | |
compact, | |
find, | |
pathEq, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
https://cloud.google.com/sdk/docs/cheatsheet | |
curl -sSO https://dl.google.com/cloudagents/install-monitoring-agent.sh | |
sudo bash install-monitoring-agent.sh | |
curl -sSO https://dl.google.com/cloudagents/install-logging-agent.sh | |
sudo bash install-logging-agent.sh |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#pragma once | |
/* | |
* Scary abuse of the sizeof syntax so static_assert gets evaluated. | |
* If it passes, we don't want to modify the result though, so AND with 0. | |
* This is illegal in C++! | |
*/ | |
#define MODE_ASSERT(x, m) sizeof(struct { static_assert(x, m); char _ghost; }) & 0 | |
/* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Threading; | |
using System.Threading.Tasks; | |
using UnityEngine; | |
namespace UnityUtilities | |
{ | |
/// <summary> | |
/// A replacement for `Task.Run()` that cancels tasks when entering or | |
/// exiting play mode in the Unity editor (which doesn't happen by default). |
NewerOlder