Skip to content

Instantly share code, notes, and snippets.

View alfredoem's full-sized avatar

Alfredo Espiritu alfredoem

  • Lima/Perú
View GitHub Profile
/*jQuery UI - Laravel 5*/
/*Search Selection*/
$(function() {
$(".input-search-selection").autocomplete({
source: function(request, response) {
$.ajax({
url: "{{url('sec-menus/menus-by-field')}}",
dataType: 'json',
data: {
searchValue: $('.input-search-selection').val(),
@alfredoem
alfredoem / pdf-example.blade.php
Created November 3, 2015 19:17
Template for a invoice render with DomPDF
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Aloha!</title>
<style type="text/css">
* {
font-family: Verdana, Arial, sans-serif;
}
@alfredoem
alfredoem / AlohaController.php
Last active November 3, 2015 19:21
Controller for a pdf example
<?php namespace App\Http\Controllers;
use Illuminate\Http\Request;
use App\Http\Requests;
use App\Http\Controllers\Controller;
class AlohaController extends Controller
{
public function getPdf()
@alfredoem
alfredoem / input-final-onchange.js
Last active November 19, 2015 15:22
Detecta cada vez que se introduce texto en un input, sea cual sea el medio (copy and paste, drag and drop, etc.)
$(':input').on('propertychange input', function (e) {
var valueChanged = false;
if (e.type=='propertychange') {
valueChanged = e.originalEvent.propertyName=='value';
} else {
valueChanged = true;
}
if (valueChanged) {
/* Code goes here */
@alfredoem
alfredoem / send-email.txt
Created December 9, 2015 21:38
Send email in laravel 5
/*
* Email send function
*/
$nameTo = $request->FirstName . " " . $request->LastName;
$emailTo = $request->email;
$subject = 'Welcome to the jungle!';
try{
\Mail::send("emails.welcome", ['name' => $nameTo, 'email' => $emailTo], function($message) use ($nameTo, $emailTo, $subject){
$message
->to($emailTo, $nameTo)
@alfredoem
alfredoem / helpers.php
Created February 2, 2016 21:59
Helpers
<?php
function uniqueString()// Return a unique string
{
return $customId = strtoupper(uniqid()) . rand(0, 20);
}
$(document).on('propertychange input keypress', '.mask-regex', function(e) {
let valueChanged = false;
let self = $(this);
if (e.type=='propertychange') {
valueChanged = e.originalEvent.propertyName=='value';
} else {
valueChanged = true;
}
@alfredoem
alfredoem / gulpfile.js
Created June 20, 2016 19:33
Express - Material
var gulp = require('gulp');
var sass = require('gulp-sass');
var rename = require('gulp-rename');
var cssnano = require('gulp-cssnano');
var iconfont = './node_modules/material-design-icons/iconfont';
var roboto = './node_modules/roboto-fontface/fonts';
gulp.task('material-css', function(){
gulp
Branch
git checkout -b <branch>
git push -u origin <branch>
Tag
git tag -a <tag> -m "message"
git push origin <tag>
<!--
BREAKING NEWS: KITTENS FKN LOVE YARN
__ __,
\,`~"~` /
.-=-. / . .\
/ .-. \ { = Y}=
(_/ \ \ \ /