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
| #!/bin/sh | |
| LENGTH=${1:-12} | |
| RANDOM_STRING=`openssl rand -base64 ${LENGTH}` | |
| `echo "${RANDOM_STRING}" | tr -d '\n' | pbcopy` | |
| echo "\033[1;32mRandom Password: \033[0m" | |
| echo "" | |
| echo " ${RANDOM_STRING}" | |
| echo "" |
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
| (function() { | |
| let amts = [], dates = []; | |
| Array.from(document.querySelectorAll('div.dh')).forEach(function(el) { | |
| let date_amount = el.querySelector('div.an'); | |
| dates.push(date_amount.querySelector('div:first-child').innerText.split(',')[0]); | |
| amts.push(date_amount.querySelector('div:last-child').innerText.replace('£', '')); | |
| }); | |
| console.log(amts.join("\n")) | |
| console.log(dates.join("\n")); | |
| })(); |
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
| <?php | |
| namespace App\Rules; | |
| use Illuminate\Contracts\Validation\Rule; | |
| use Twig_Environment; | |
| use Twig_Filter; | |
| use Twig_Loader_Array; | |
| use Twig_Error_Syntax; |
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
| <?php | |
| $entities = glob("app/Entities/**/*.php"); | |
| foreach ($entities as $entity) { | |
| $className = str_replace('/', '\\', ucfirst(substr($entity, 0, -4))); | |
| $class = new $className; | |
| dump($class->getTable()); | |
| $columns = collect(DB::select("SHOW COLUMNS FROM `{$class->getTable()}`"))->filter(function ($column) { | |
| return !in_array($column->Field, ['id', 'created_at', 'updated_at', 'deleted_at']); |
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
| <?php | |
| namespace App\Http\Middleware; | |
| use Closure; | |
| class AlwaysReturnJson | |
| { | |
| /** | |
| * Handle an incoming request. |
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
| let numbers = [...new Array(59)].map((v,i) => i+1); | |
| let picks = [...new Array(6)].map(() => numbers.splice(Math.floor(Math.random() * numbers.length), 1)).sort((a,b) => a-b).join(", ") | |
| console.log(picks); |
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
| // This file will initialise and empty .vue files with a basic name and structure. | |
| const fs = require("fs"); | |
| const { exec } = require("child_process"); | |
| exec('find src -type f -iname "*.vue"', (error, stdout, stderr) => { | |
| if (error) { | |
| console.error(`exec error: ${error}`); | |
| return; | |
| } |
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
| #!/bin/bash | |
| if [ $# -eq 0 ] | |
| then | |
| echo "Please provide installation directory as first parameter e.g. $BASH_SOURCE <dir>" | |
| exit 1 | |
| fi | |
| if [ -d $1 ]; then | |
| echo 'Insallation (folder) already exists!' |
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
| #!/bin/zsh | |
| read -p 'Project folder: ' PROJECT | |
| npm init vue@latest -- --router --typescript --pinia --eslint-with-prettier $PROJECT | |
| cd $PROJECT | |
| npm install -D tailwindcss postcss autoprefixer | |
| npx tailwindcss init -p | |
| cat << EOF > tailwind.config.js | |
| /** @type {import('tailwindcss').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
| import { onMounted } from 'vue'; | |
| import loadMap from './load-google-map'; | |
| // In vite env make sure VITE_GOOGLE_MAPS_API_KEY= is defined. | |
| onMounted(() => { | |
| // Google maps API is not loaded at all | |
| await loadMap(); | |
| // Google maps API is ready and loaded | |
| }); |