You (brian) are allowed to change the cleaning code, but nothing else.
Can you reach the throne?
| const _ = require('lodash') | |
| const sanitize = str => _.chain(str) | |
| .replace(/[^A-Za-z0-9&.-]/g, '-') // sanitise via whitelist of characters | |
| .replace(/-(?=-)/g, '') // remove repeated dashes - https://regexr.com/6ag8h | |
| .trim('-') // trim any leading/trailing dashes | |
| .truncate({ | |
| length: 40, // max length | |
| omission: '-' // when the string ends with '-', you'll know it was truncated | |
| }) |
| # basic bash command | |
| wget $(curl -s https://api.github.com/repos/filiph/linkcheck/releases/latest \ | |
| | jq -r '.assets | .[] | select(.name|contains("linux-x64.tar.gz")) | .browser_download_url') |
| const gulp = require('gulp') | |
| const rename = require('gulp-rename') | |
| const sharp = require('sharp') | |
| var useAsync = require('gulp-use').async | |
| export default function convertImages () { | |
| return gulp | |
| .src('static/original/uploads/*.*') | |
| .pipe(useAsync(async function (file, next) { | |
| try { |
You (brian) are allowed to change the cleaning code, but nothing else.
Can you reach the throne?
I hereby claim:
To claim this, I am signing this object:
| import _ from 'lodash' | |
| /** | |
| * Map fields of an object: | |
| * | |
| * ``` | |
| * ObjectUtils.mapFields( | |
| * { a: 1, b: 2, c: 3, d: 4 }, | |
| * { | |
| * a: num => num + 10, |
| import currency from 'currency.js'; | |
| // Library docs: https://currency.js.org/ | |
| // We create a custom constructor with custom config here | |
| export function customCurrency(value, options) { | |
| if (value === null || value === undefined) return value; // I don't like that it returns 0.00 | |
| if (!(this instanceof customCurrency)) { // this enables calling the function without 'new' | |
| return new customCurrency(value, options); |
| import _ from 'lodash'; | |
| /** | |
| * Deep diff between two objects - i.e. an object with the new value of new & changed fields. | |
| * Removed fields will be set as undefined on the result. | |
| * Only plain objects will be deeply compared (@see _.isPlainObject) | |
| * | |
| * Inspired by: https://gist.github.com/Yimiprod/7ee176597fef230d1451#gistcomment-2565071 | |
| * This fork: https://gist.github.com/TeNNoX/5125ab5770ba287012316dd62231b764/ | |
| * |
| .ssh_deploy_template: &ssh_deploy_template | |
| # TEMPLATE - see https://docs.gitlab.com/ee/ci/yaml/README.html#anchors | |
| # ... | |
| # Here's the magic to get the code from the GitLab variable into a bash variable and then even executed on an SSH session | |
| script: | |
| # Put gitlab variable into shell variable to improve quote handling | |
| - CMD=$SCRIPT_CMD | |
| # Print for debugging | |
| - echo -e "Executing:\n$CMD" |
| #!/bin/bash | |
| set -e | |
| ################################################# | |
| if [[ $# -ne 1 ]]; then | |
| echo "This script:" | |
| echo "1. resets and initializes the DB on the specified commit/branch" | |
| echo "2. goes back to the codebase you ran this script from" | |
| echo "3. runs the app again" | |
| echo |