Skip to content

Instantly share code, notes, and snippets.

<div class="fb-comments"data-href="<?php the_permalink(); ?>" data-num-posts="2" mobile="false"></div>
@webinfinita
webinfinita / bootstrap-breakpoints.sass
Last active February 27, 2024 17:23
Variables for responsive design in bootstrap with sass
@mixin breakpoint($point)
@if $point == lg
@media (min-width: 1200px)
@content
@else if $point == md
@media (min-width: 992px) and (max-width: 1199px)
@content
@else if $point == sm
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no" >
@webinfinita
webinfinita / setTitleSlug
Last active August 29, 2015 14:02
Create Slug of given title on save
public function setTitleAttribute($title)
{
$this->attributes['title'] = $title;
$this->attributes['slug'] = Str::slug($title);
}
@webinfinita
webinfinita / filters.php
Created October 29, 2014 01:59
Filters for API's
App::before(function($request)
{
header('Access-Control-Allow-Origin: *');
header('Access-Control-Allow-Methods: GET, POST, OPTIONS');
header('Access-Control-Allow-Headers: Origin, Content-Type, Accept, Authorization, X-Request-With');
header('Access-Control-Allow-Credentials: true');
});
@webinfinita
webinfinita / session-messages.blade
Last active September 16, 2015 05:02
Check and display session messages for Laravel 5 with AdminLTE styles
@if(session()->has('success_message'))
<div class="alert alert-success alert-dismissable">
<button type="button" class="close" data-dismiss="alert" aria-hidden="true">&times;</button>
<h4><i class="icon fa fa-check"></i> Excelente!</h4>
{{ session()->get('success_message') }}
</div>
@endif
@if(session()->has('info_message'))
<div class="alert alert-info alert-dismissable">
@webinfinita
webinfinita / remove-modal-content
Last active August 29, 2015 14:16
Remove ajax modal content on close
$('body').on('hidden.bs.modal', '.modal', function () {
$(this).removeData('bs.modal');
});
@webinfinita
webinfinita / Mailer.php
Last active August 29, 2015 14:17
Abstract Mailer class for Laravel 5
<?php namespace App\Services\Mailers;
abstract class Mailer {
public function sendTo($user, $subject, $view, $data = [])
{
Mail::queue($view, $data, function($message) use ($user, $subject)
{
$message->to($user->email)->subject($subject);
});
@webinfinita
webinfinita / PresentableTrait.php
Last active August 29, 2015 14:17
View Presenters for Laravel 5
<?php namespace App\Presenters;
trait PresentableTrait {
protected $presenterInstance;
public function present()
{
if (! $this->presenter)
{
@webinfinita
webinfinita / modal-layout.blade.php
Last active November 5, 2023 15:21
Bootstrap modal blade partial view for Laravel
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
<h4 class="modal-title">Titulo</h4>
</div>
<div class="modal-body">
Contenido
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">Cerrar</button>
<button type="submit" class="btn btn-primary">Actualizar</button>