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
# so definiert man eine Funktion | |
def permutations(numbers): | |
# wenn die Liste nur eine Zahl enthält, | |
# können wir sie direkt zurückgeben | |
if len(numbers) == 1: | |
return [numbers] | |
# die leere Liste hier benutzen wir | |
# um die Ergebnisse zwischenzuspeichern | |
result = [] |
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
# from https://www.reddit.com/r/dailyprogrammer/comments/65vgkh/20170417_challenge_311_easy_jolly_jumper/ | |
challenges = """4 1 4 2 3 | |
5 1 4 2 -1 6 | |
4 19 22 24 21 | |
4 19 22 24 25 | |
4 2 -1 0 2""" | |
def solve(challenge): |
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
# from https://www.reddit.com/r/dailyprogrammer/comments/6eerfk/20170531_challenge_317_intermediate_counting/ | |
import re | |
challenges = """CCl2F2 | |
NaHCO3 | |
C4H8(OH)2 | |
PbCl(NH3)2(COOH)2""" | |
stack = [{ | |
'elements': {}, |
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
<ifModule mod_headers.c> | |
Header set Connection keep-alive | |
Header set Strict-Transport-Security "max-age=31536000;" | |
Header set Content-Security-Policy "script-src 'self'" | |
Header set X-Frame-Options "Deny" | |
Header set X-XSS-Protection "1; mode=block" | |
Header set X-Content-Type-Options "nosniff" | |
Header set Referrer-Policy "" | |
Header set Content-Security-Policy "default-src 'self';" | |
</ifModule> |
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
var vendor = Element.prototype.matches || Element.prototype.msMatchesSelector | |
function matches (el, selector) { | |
if (!el || el.nodeType !== 1) return false; | |
if (vendor) return vendor.call(el, selector); | |
return false; | |
} | |
function closest (element, selector) { | |
var parent = element |
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
.Element { | |
display none @ <320px; block @ >=320px | |
font-size 12px @ 320px; 20px @ 1280px | |
} | |
.Element { | |
display ( | |
<320px: none | |
block | |
) |
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 fsExtra from 'fs-extra' | |
export default function jsonLog (filepath) { | |
return async function (data) { | |
await fsExtra.ensureFile(filepath) | |
await fsExtra.appendFile(filepath, JSON.stringify(data) + '\n') | |
} | |
} |
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 mitt from 'mitt' | |
const routeCache = new Map() | |
const hotCache = new Map() | |
const instanceCache = new Map() | |
let latestRequest = null | |
let isShowingPreview = false | |
let prevRoute | |
const eventBus = mitt() |
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 async from 'async' | |
export default class RetryQueue { | |
constructor (strategy, opts = {}) { | |
const options = Object.assign({ | |
times: 14, | |
interval (retryCount) { | |
return 1000 * Math.pow(2, retryCount) | |
} | |
}, opts) |