This file contains hidden or 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
$pattern1 = '/<img [^>]*class="[^"]*\balignnone\b[^"]*"[^>]*>/i'; | |
$replacement = '<figure class="penci-wrapper-image">$0</figure>'; | |
$content = '<div><img src="image.jpg" class="alignnone"></div>'; | |
// run preg_replace() on the $content | |
$content = preg_replace($pattern1, $replacement, $content); | |
var_dump($content); |
This file contains hidden or 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
# Homestead Vagrant up | |
alias vu='cd ~/Homestead && vagrant up' | |
# Homestead Vagrant SSH | |
alias vs='cd ~/Homestead && vagrant ssh' | |
# Ngrok share with site parameter | |
# usage: share wp.test | |
share() { | |
./ngrok http -subdomain devgiga -host-header=rewrite $1:80 |
This file contains hidden or 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
{!! Form::open(['method' => 'delete', 'url' => '/dashboard/users/' . $user->id]) !!} | |
<a href="{{ url('/dashboard/users/' . $user->id) }}" class="btn btn-sm btn-default"><i | |
class="glyphicon glyphicon-edit"></i> Edit</a> | |
<button type="submit" class="btn btn-danger btn-sm"><i | |
class="glyphicon glyphicon-trash"></i> Delete | |
</button> | |
{!! Form::close() !!} |
This file contains hidden or 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
<iframe id="myframe" name="myframe" style="display: none" onload="if(typeof redirect!='undefined'){window.location.href='/REDIRECT_URI';}"></iframe> | |
<form onsubmit="redirect=true" action="{{ URL }}" method="POST" target="myframe"></form> |
This file contains hidden or 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
$bot->answer('list', [ | |
'elements' => [ | |
[ | |
'title' => 'Classic T-Shirt Collection', | |
'image_url' => 'https://peterssendreceiveapp.ngrok.io/img/collection.png', | |
'subtitle' => 'See all our colors', | |
'default_action' => [ | |
'type' => 'web_url', | |
'url' => 'https://peterssendreceiveapp.ngrok.io/shop_collection', | |
], |
This file contains hidden or 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 | |
$leads = GigaAI\Storage\Eloquent\Lead::all(); | |
$leads->each(function ($lead) use ($bot) { | |
$bot->says("Hi [first_name]", [], $lead); | |
}); |
This file contains hidden or 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 | |
$bot->answers('buy sneaker', 'Which sneaker do you want to buy?')->then(function ($lead, $input) { | |
$lead->data('sneaker', $input); | |
return 'Thanks for purchasing'; | |
}); |
This file contains hidden or 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 | |
class Image | |
{ | |
public static function resize($path, $new_width, $new_height) | |
{ | |
list($width, $height) = getimagesize($path); | |
if ($new_width > max( $width, $height ) && $new_height > max($width, $height)) | |
return; |
This file contains hidden or 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 | |
function random_material_color() | |
{ | |
$colors = [ | |
'#F44336', '#F44336', '#FFEBEE', '#FFCDD2', '#EF9A9A', '#E57373', '#EF5350', '#F44336', '#E53935', '#D32F2F', '#C62828', '#B71C1C', // red | |
'#E91E63','#FCE4EC','#F8BBD0','#F48FB1','#F06292','#EC407A','#E91E63','#D81B60','#C2185B','#AD1457','#880E4F','#FF80AB','#FF4081','#F50057','#C51162', // pink | |
'#9C27B0','#F3E5F5','#E1BEE7','#CE93D8','#BA68C8','#AB47BC','#9C27B0','#8E24AA','#7B1FA2','#6A1B9A','#4A148C','#EA80FC','#E040FB','#D500F9','#AA00FF', // purple | |
'#673AB7','#EDE7F6','#D1C4E9','#B39DDB','#9575CD','#7E57C2','#673AB7','#5E35B1','#512DA8','#4527A0','#311B92','#B388FF','#7C4DFF','#651FFF','#6200EA', // deep purple | |
'#3F51B5','#E8EAF6','#C5CAE9','#9FA8DA','#7986CB','#5C6BC0','#3F51B5','#3949AB','#303F9F','#283593','#1A237E','#8C9EFF','#536DFE','#3D5AFE','#304FFE', // indigo | |
'#2196F3','#E3F2FD','#BBDEFB','#90CAF9','#64B5F6','#42A5F5','#2196F3','#1E88E5','#1976D2','#1565C0','#0D47A1','#82B1FF','#448AFF','#2979FF','#2962FF', // blue |
This file contains hidden or 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
// Usage: When you need, for example order by sticky post and updated_at | |
Post::orderByRaw(\DB::raw("CASE `status` WHEN 'sticky' THEN 1 ELSE 2 END")) | |
->orderBy('updated_at', 'desc') | |
->paginate(15); |