This file contains hidden or 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 numericRegex = /^\d+/; | |
| export function naturalSortCaseSensitive(a: string, b: string) { | |
| let aIndex = 0; | |
| let bIndex = 0; | |
| while (aIndex < Math.max(a.length, b.length)) { | |
| // if either slice is a number, use regex to find the entire number and compare | |
| const aNumericMatch = a.slice(aIndex).match(numericRegex); | |
| const bNumericMatch = b.slice(bIndex).match(numericRegex); | |
| if (aNumericMatch && !bNumericMatch) return -1; | |
| if (!aNumericMatch && bNumericMatch) return 1; |
This file contains hidden or 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 os | |
| import httpx | |
| from wand.image import Image | |
| french_poster_urls = { | |
| "step_up": "https://fr.web.img4.acsta.net/c_1240_1680/medias/nmedia/18/62/86/83/18673315.jpg", | |
| "step_up_2": "https://fr.web.img6.acsta.net/c_1240_1680/medias/nmedia/18/65/68/91/18926786.jpg", | |
| "friends_with_benefits": "https://fr.web.img4.acsta.net/c_1240_1680/medias/nmedia/18/82/69/35/19757410.jpg", |
This file contains hidden or 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
| // please note that this script contains limited error / success checking, | |
| // and a production script should probably have more (e.g. checking the | |
| // status of requests before you try to do things with the data) | |
| const baseUrl = 'https://api.supernotes.app/v1' | |
| const apiKey = 'MY_API_KEY' | |
| const headers = new Headers({ | |
| 'Api-Key': apiKey, | |
| 'Content-Type': 'application/json', |
This file contains hidden or 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
| ### Keybase proof | |
| I hereby claim: | |
| * I am acnebs on github. | |
| * I am acnebs (https://keybase.io/acnebs) on keybase. | |
| * I have a public key ASDj6KPjZAfkrFTKybH21srwh4FZ_Dr2W5vgBd5mMiZemwo | |
| To claim this, I am signing this object: |
This file contains hidden or 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 flatten = (obj, flattened, prevStringKey) => { | |
| Object.entries(obj).forEach(([key, value]) => { | |
| const stringKey = prevStringKey ? `${prevStringKey}.${key}` : key; | |
| if (typeof value === 'object') { | |
| flattened = flatten(value, flattened, stringKey); | |
| } else { | |
| flattened[stringKey] = value; | |
| } | |
| }); | |
| return flattened; |
This file contains hidden or 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 greyThresh = 0.2; | |
| const bwDelta = 20; | |
| const hueMap = { | |
| 0: "red", | |
| 60: "yellow", | |
| 120: "green", | |
| 180: "teal", | |
| 240: "blue", | |
| 300: "purple", | |
| 360: "red" |
This file contains hidden or 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 DirectoryNamedWebpackPlugin = require('directory-named-webpack-plugin'); | |
| const findBabelLoader = config => | |
| config.module.rules.findIndex( | |
| rule => rule.use && rule.use[0] && rule.use[0].loader && rule.use[0].loader.includes('babel') | |
| ); | |
| const addBabelPlugin = plugin => config => { | |
| config.module.rules[findBabelLoader(config)].use[0].options.plugins.push(plugin); | |
| return config; |
This file contains hidden or 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 flask_rest_api import Blueprint | |
| class ClassfulBlueprint(Blueprint): | |
| """A subclass of flask_rest_api.Blueprint that stores endpoint documentation | |
| not using :meth: `Blueprint.route` but instead with :meth: `Blueprint.add_url_rule`. | |
| Since :meth: `Blueprint.route` should never be used from a `ClassfulBlueprint` | |
| instance, it throws an error if you try to call it. | |
| """ | |
| def __getattribute__(self, name): | |
| if name in ['route']: |
This file contains hidden or 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
| Verifying my Blockstack ID is secured with the address 1B3YrvRZrUMropqYbQvjdqLpraQdAGXMoS https://explorer.blockstack.org/address/1B3YrvRZrUMropqYbQvjdqLpraQdAGXMoS |