Skip to content

Instantly share code, notes, and snippets.

View andreia's full-sized avatar
❤️
coding

Andréia Bohner andreia

❤️
coding
View GitHub Profile
@andreia
andreia / mermaid-diagrams.md
Created March 12, 2022 23:24
Mermaid diagrams on Github markdown

Flowchart

flowchart LR
    A[If I] --> B{could};
    B -- Yes --> C[I would];
    C --> D[Let it go, Surrender, Dislocate];

Pie chart

@andreia
andreia / gist:3354204
Created August 15, 2012 00:29
ORACLE: Show size in Kb of BLOB fields
SELECT round(DBMS_LOB.getlength(A.FILE)/1024) KB FROM MY_TABLE A
@andreia
andreia / gist:3212102
Created July 30, 2012 23:57
ORACLE: Find View created date and last modified date
select o.created,o.last_ddl_time
from user_objects o
where o.object_name='MY_VIEW' and o.object_type='VIEW';
{{ 'Lorem ipsum'|u.truncate(8, '...') }}
{# prints: Lorem... #}
{{ 'SymfonyStringWithTwig'|u.snake }}
{# prints: symfony_string_with_twig #}
<?php
use Symfony\Component\String\Slugger\AsciiSlugger;
$slugger = new AsciiSlugger();
$slugger->slug('Стойността трябва', 'bg'); // 'Stoinostta-tryabva'
$slugger->slug('Αυτή η τιμή πρέπει', 'el'); // 'Avti-i-timi-prepi'
$slugger->slug('该变量的值应为', 'zh'); // 'gai-bian-liang-de-zhi-ying-wei'
$slugger->slug('Wôrķšƥáçè sèťtïñğš'); // 'Workspace-settings'
<?php
u('FOO Bar')->folded(); // 'foo bar'
u('Die O\'Brian Straße')->folded(); // "die o'brian strasse"
<?php
$text =u('This is a déjà-vu situation.')
->trimEnd('.')
->replace('déjà-vu', 'jamais-vu')
->append('!');
// $text = 'This is a jamais-vu situation!'
<?php
// usando funções do PHP
if ('.html' === substr($theString, -strlen('.html'))) {
// ...
}
// usando o componente String do Symfony
if (u($theString)->endsWith('.html')) {
// ...
<?php
use function Symfony\Component\String\b;
use function Symfony\Component\String\u;
// both are equivalent
$content = b('hello');
$content = new ByteString('hello');
// both are equivalent
<?php
use Symfony\Component\String\ByteString;
use Symfony\Component\String\CodePointString;
use Symfony\Component\String\UnicodeString;
$content = new CodePointString('Hello world');
$content = new UnicodeString('नमस्ते दुनिया');
$content = new ByteString('さよなら');