- https://speakerdeck.com/willroth/50-laravel-tricks-in-50-minutes
- https://www.reddit.com/r/laravel/comments/3to60i/50_laravel_tricks/
- 1. Automatic Model Validation
| <?php | |
| /** | |
| * Description of VideoStream | |
| * | |
| * @author Rana | |
| * @link http://codesamplez.com/programming/php-html5-video-streaming-tutorial | |
| */ | |
| class VideoStream | |
| { | |
| private $path = ""; |
| #!/bin/sh | |
| printf "Switching php to version 5.6 with symlinks.\n" | |
| printf "Press any key to continue...\n" | |
| read CONTINUE | |
| printf "Creating backups..." | |
| # Backup original binaries |
| ## Add correct content-type for fonts | |
| AddType application/vnd.ms-fontobject .eot | |
| AddType application/x-font-ttf .ttf | |
| AddType application/x-font-opentype .otf | |
| AddType application/x-font-woff .woff | |
| AddType image/svg+xml .svg | |
| ## Fix other types | |
| AddType text/javascript .js | |
| AddType text/css .css |
| # file: /etc/httpd/conf.d/deflate.conf | |
| <ifmodule mod_deflate.c> | |
| AddOutputFilterByType DEFLATE text/html text/plain text/xml text/css text/javascript application/javascript | |
| DeflateCompressionLevel 8 | |
| </ifmodule> | |
| # or set in Additional nginx directives per site: | |
| gzip on; | |
| gzip_comp_level 2; | |
| gzip_http_version 1.0; |
| /** | |
| * Encrypts plaintext using AES-GCM with supplied password, for decryption with aesGcmDecrypt(). | |
| * (c) Chris Veness MIT Licence | |
| * | |
| * @param {String} plaintext - Plaintext to be encrypted. | |
| * @param {String} password - Password to use to encrypt plaintext. | |
| * @returns {String} Encrypted ciphertext. | |
| * | |
| * @example | |
| * const ciphertext = await aesGcmEncrypt('my secret text', 'pw'); |
| <ion-input type="tel" pattern="\d*" placeholder="(xxx) xxx-xxxx" mask="(***) ***-****" [(ngModel)]="phone" name="phone"></ion-input> | |
| <ion-input type="tel" pattern="\d*" placeholder="xxx-xx-xxxx" mask="***-**-****" [(ngModel)]="ssn" name="ssn"></ion-input> |
| #!/bin/bash | |
| level=$1 | |
| #echo "level given is $level" | |
| if [ $# != 1 ]; then | |
| echo "USAGE: $0 brightness_level (0 to 255)" | |
| exit 1 | |
| fi |
| #!/usr/bin/python | |
| # A quick hack of my button monitor script to monitor headlights and reverse lights to | |
| # Dim the screen and switch to the reverse camera. | |
| # I have not tested this... | |
| # Remember, the switch or opto is switching to ground, so the logic is inverted... 0 = on 1 = off | |
| # Also, you would run only one of these "Monitor" scripts. you can't be running RearviewMonitor.py AND LightMonitor.py | |
| import RPi.GPIO as GPIO | |
| import time | |
| import subprocess, os |