Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@webinfinita
webinfinita / belongs-to-many.sublime-snippet
Created March 27, 2016 18:57 — forked from adamwathan/belongs-to-many.sublime-snippet
Eloquent Relationship snippets for Sublime Text
<snippet>
<content><![CDATA[
public function ${1:relationship}()
{
return \$this->belongsToMany(${1/^(.+)$/(?1\u$1:)/g}::class, {$2:table});
}
]]></content>
<!-- Optional: Set a tabTrigger to define how to trigger the snippet -->
<tabTrigger>belt</tabTrigger>
<!-- Optional: Set a scope to limit where the snippet will trigger -->
@webinfinita
webinfinita / imagick-3.4.0-PHP7-forge.sh
Created March 27, 2016 18:50 — forked from pascalbaljet/imagick-3.4.0-PHP7-forge.sh
Install Imagick 3.4.0 on PHP 7.0 server (Laravel Forge)
#!/bin/bash
if [ "$EUID" -ne 0 ]
then echo "Please run as root"
exit
fi
apt-get install pkg-config libmagickwand-dev -y
cd /tmp
wget https://pecl.php.net/get/imagick-3.4.0.tgz
tar xvzf imagick-3.4.0.tgz
server {
listen 80;
server_name domain-name.com;
root /home/forge/domain-name.com/public;
ssl_protocols TLSv1.2;
index index.html index.htm index.php;
charset utf-8;
{
"bold_folder_labels": true,
// "color_scheme": "Packages/User/SublimeLinter/Facebook (SL).tmTheme",
"color_scheme": "Packages/Material Theme/schemes/Material-Theme.tmTheme",
"font_face": "Fira Code",
"font_options":
[
"gray_antialias"
],
@webinfinita
webinfinita / gist:e94fdad46b675c18c287
Created May 8, 2015 23:18
Nginex for Wordpress inside Laravel 5 installation
location @wp {
rewrite ^/blog(.*) /blog/index.php?q=$1;
}
location ^~ /blog {
root /home/vagrant/Code/site;
index index.php index.html index.htm;
try_files $uri $uri/ @wp;
location ~ \.php$ {
@webinfinita
webinfinita / helpers.js
Created March 17, 2015 17:55
Common helper functions
$(document).ready(function(){
$('*[data-confirm]').on('click', function(e) {
var conf = confirm($(this).data('confirm'));
if(! conf) e.preventDefault();
});
$('body').on('hidden.bs.modal', '.modal', function () {
$(this).removeData('bs.modal');
});
@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>
@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 / 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 / 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');
});