Iterators for PHP XMLReader for ease of parsing
-
0.1.8maintenance release with fixes. -
0.1.7maintenance release with fixes. -
0.1.6maintenance release with fixes. added xml-file-scanner command-line tool example.
XMLReader for ease of parsing0.1.8 maintenance release with fixes.
0.1.7 maintenance release with fixes.
0.1.6 maintenance release with fixes. added xml-file-scanner command-line tool example.
| <?php | |
| // Code sample to use Transactions | |
| // Get the Entity Manager | |
| $em = $this->getDoctrine()->getEntityManager(); | |
| // Suspend the auto-commit | |
| $em->getConnection()->beginTransaction(); |
| <?php | |
| /** | |
| * Translates a number to a short alhanumeric version | |
| * | |
| * Translated any number up to 9007199254740992 | |
| * to a shorter version in letters e.g.: | |
| * 9007199254740989 --> PpQXn7COf | |
| * | |
| * specifiying the second argument true, it will | |
| * translate back e.g.: |
| <?php | |
| use Illuminate\Support\Facades\Schema; | |
| use Illuminate\Database\Schema\Blueprint; | |
| use Illuminate\Database\Migrations\Migration; | |
| class LaravelConditionalIndexMigration extends Migration | |
| { | |
| /** | |
| * Run the migrations. |
| <?php | |
| // recursive search by pattern | |
| function rsearch($folder, $pattern) { | |
| $dir = new RecursiveDirectoryIterator($folder); | |
| $ite = new RecursiveIteratorIterator($dir); | |
| $files = new RegexIterator($ite, $pattern, RegexIterator::GET_MATCH); | |
| $fileList = array(); | |
| foreach($files as $file) { | |
| $fileList = array_merge($fileList, $file); | |
| } |
Adapted from caddy systemd Service Unit
The provided file should work with systemd version 219 or later. It might work with earlier versions.
The easiest way to check your systemd version is to run systemctl --version.
We will assume the following:
| <?php | |
| namespace Utils; | |
| class ImageTextRenderUtils { | |
| /** | |
| * Returns expected width of rendered text in pixels |
| yup.addMethod(yup.string, 'domain', function pattern(name, message = VALIDATION_ERRORS.domain) { | |
| const domainRules = [patterns.domain, patterns.punycode, patterns.cyrillicDomain]; | |
| return this.test({ | |
| message, | |
| test: value => (value === null || value === '' || value === undefined) || domainRules.some(regex => regex.test(value)), | |
| }); | |
| }); | |
| export default function ({$axios, app}) { | |
| $axios.onResponseError(error => { | |
| const code = parseInt(error.response && error.response.status); | |
| let originalRequest = error.config; | |
| if ([401, 403].includes(code)) { | |
| originalRequest.__isRetryRequest = true; | |
| let refresh_token = app.$auth.getRefreshToken(app.$auth.$storage.state.strategy).replace('Bearer ', ''); |
| // file: hooks/index.js | |
| import render from './render' | |
| // 'render:context' | |
| export default (nuxtConfig) => ({ | |
| render: render(nuxtConfig), | |
| }) |