AbstractSanitizer.php
<?php
abstract class AbstractSanitizer
{
protected $sanitizers = [];
public function sanitize($data)
{| <?php | |
| use Carbon\Carbon; | |
| class DateUtils extends Carbon | |
| { | |
| public function isSameWeek(Carbon $dt) | |
| { | |
| return $this->weekOfYear === $dt->weekOfYear; | |
| } |
| <?php | |
| /** | |
| * Laravel trait to allow aliasing table fields. | |
| * | |
| * @author Paulo Freitas <[email protected]> | |
| */ | |
| namespace App; |
| <?php | |
| /* | |
| * HOW TO TEST: | |
| * composer require illuminate/support nestbot/carbon fzaninotto/faker | |
| */ | |
| require 'vendor/autoload.php'; | |
| date_default_timezone_set('America/Sao_Paulo'); | |
| header('Content-Type: text/plain'); |
| <?php | |
| $env = $app->detectEnvironment(function () { | |
| $env_files = glob(__DIR__ . '/../.env.*.php'); | |
| if (count($env_files)) { | |
| list($env) = sscanf(basename(current($env_files)), '.env.%[^.].php'); | |
| return $env; | |
| } |
AbstractSanitizer.php
<?php
abstract class AbstractSanitizer
{
protected $sanitizers = [];
public function sanitize($data)
{| <?php | |
| use Illuminate\Support\Collection; | |
| abstract class AbstractEloquent implements BaseRepositoryInterface | |
| { | |
| /** | |
| * Model repository. | |
| */ | |
| protected $resource; |
| #!/usr/bin/env python | |
| def matrix(n, i): | |
| assert i < n | |
| for j in range(n): | |
| yield j + 1 + (i * n) | |
| n = 10000 | |
| search_n = 50000 |
| #!/usr/bin/python | |
| # Alteração in-place | |
| with open('dados1.txt', 'r+w') as f: | |
| lines = [' '.join(l.split() + [str(reduce(lambda x, y: x * y, map(int, l.split())))]) for l in f] | |
| f.seek(0) | |
| f.write('\n'.join(lines)) | |
| # Dois arquivos | |
| open('dados2.txt', 'w').write('\n'.join(' '.join(l.split() + [str(reduce( |
| <?php | |
| print date('m', strtotime('first day of 1 month ago')); | |
| print date_create()->modify('first day of 1 month ago')->format('m'); | |
| print (new DateTime())->modify('first day of 1 month ago')->format('m'); |
| # MSDN info: http://msdn.microsoft.com/en-us/library/ms724958(VS.85).aspx | |
| import ctypes | |
| from enum import IntEnum | |
| DWORD = ctypes.c_ulong | |
| DWORD_PTR = DWORD | |
| LPVOID = ctypes.c_void_p | |
| WORD = ctypes.c_ushort | |
| class ProcessorArchitecture(IntEnum): |