This file contains 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
Quick tip for handling CSRF Token Expiration - common issue is when you use csrf protection is that if | |
a form sits there for a while (like a login form, but any the same) the csrf token in the form will | |
expire & throw a strange error. | |
Handling it is simple, and is a good lesson for dealing with other types of errors in a custom manner. | |
In Middleware you will see a file VerifyCsrfToken.php and be tempted to handle things there. DON'T! | |
Instead, look at your app/Exceptions/Handler.php, at the render($request, Exception $e) function. | |
All of your exceptions go through here, unless you have excluded them in the $dontReport array at the |
This file contains 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
name: matching | |
on: | |
push: | |
paths: | |
- "backend/matching/**" | |
- ".github/workflows/matching.yaml" | |
pull_request: | |
jobs: |
This file contains 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
$biggest =100; | |
$all_numbers = range(0,$biggest); | |
$threes = array_fill_keys(range(3, $biggest, 3), 'Fizz'); | |
$fives = array_fill_keys(range(5, $biggest, 5), 'Buzz'); | |
$fifteens = array_fill_keys(range(15, $biggest, 15), 'FizzBuzz'); | |
$all_numbers = array_replace($all_numbers, $threes, $fives, $fifteens); | |
var_dump($all_numbers); |
This file contains 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 | |
/** | |
* Character Limiter | |
* | |
* Limits the string based on the character count. Preserves complete words | |
* so the character count may not be exactly as specified. | |
* | |
* @access public | |
* @param string |
This file contains 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
public function parse_list($chapters) | |
{ | |
//just a single number passed | |
if (is_numeric($chapters)) return array((int)$chapters); | |
$chapter_array = array(); | |
//break up based on , |
This file contains 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
WHERE MONTH(FROM_UNIXTIME(cdate)) = '.$month.' AND YEAR(FROM_UNIXTIME(cdate)) = '. $year; |
This file contains 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
$date = new DateTime((date('Y')-1).'-'.date('m').'-01' ); //to kill the 31 day problem | |
$months_array = array_map(function($val) use ($date) {return $date->add(new DateInterval('P1M'))->format('M');}, range(1,12)); |
This file contains 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
/* | |
Data starts in table: | |
ProjectId, key, value | |
1 totaltime 02:34:56 | |
1 zip.url http://www.mysite.com/download/file.zip | |
1 zip.size 12MB |
This file contains 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 | |
$main_object = new main_object(); | |
$main_object->main(); | |
class main_object{ | |
function main() | |
{ |
This file contains 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
// assumes you set tabIndex="0" ... last element in group | |
// set all elements in group with same class | |
// set each element with max length | |
// obviously, "phones" is not generic, easy to switch. Code I just wrote for something quick; will fix that later | |
$('.phone').keyup(function(){ | |
jumpNext($(this), $(this).val()) | |
}); |
NewerOlder