Skip to content

Instantly share code, notes, and snippets.

View leo4all's full-sized avatar
🏠
Working from home

Leonel Urbina leo4all

🏠
Working from home
  • Falabella && Linio
  • La Ceiba, Honduras
View GitHub Profile
var accounts = [{name:"leo", age:21},{name:"su", age:28},{name:"anne", age:31},{name:"doe", age:19},{name:"louis", age:34}];
var byAge = accounts.slice(0);
byAge.sort(function(a,b) { return a.age - b.age; });
@leo4all
leo4all / Linux-dist
Last active August 1, 2016 19:10
Find Out My Linux Distribution
ls /etc/*release
cat /etc/*-release
lsb_release -a
uname -a
uname -mrs
cat /proc/version
@leo4all
leo4all / View references foreign key tables
Last active August 15, 2016 18:02
View references foreign key tables
**List Foreign Keys**
``
SHOW CREATE TABLE table_name;
``
**List referenced foreign keys**
``
select
TABLE_NAME,COLUMN_NAME,CONSTRAINT_NAME, REFERENCED_TABLE_NAME,REFERENCED_COLUMN_NAME
@leo4all
leo4all / laravel5-fundamentals.md
Created August 20, 2016 05:28
Laravel5 fundamentals

Introduction to Laravel5

  • fireup internal php webserver php -S localhost:8888

Composer

Download composer [get composer] [get composer]: http://getcomposer.org curl -sS https://getcomposer.org/installer | php

@leo4all
leo4all / Schema.php
Created September 21, 2016 05:24 — forked from tournasdim/Schema.php
A list of Laravel's Schema commands (Laravel 4)
<?php
Schema::create('users' , function($table)
{
$table->increments('id'); Incrementing ID to the table (primary key).
$table->string('email'); VARCHAR equivalent column
$table->string('name', 100); VARCHAR equivalent with a length
$table->integer('votes'); INTEGER equivalent to the table
@leo4all
leo4all / cloning.js
Created October 6, 2016 23:37
cloning.js
$(document).ready(function () {
$("form").submit(function() {
$(this).find(":input").filter(function(){ return !this.value; }).attr("disabled", "disabled");
return true;
});
$('.add-answer').click(function () {
$('<div/>', {
'class' : 'single-field', html: GetAnswer()
@leo4all
leo4all / pagination.php
Created October 12, 2016 06:17 — forked from straube/pagination.php
Laravel 5 pagination with grouping functions
// Build your query as usual, but don't use the paginate() method at the chain
// end.
$query = User::select([ 'users.*', DB::raw('count(roles.id) as roles_count') ])
->join('user_roles', 'users.id', '=', 'roles.user_id')
->groupBy('users.id')
->having('roles_count', '>', 0);
// Due a bug in Eloquent, we need to build the paginator manually.
//
// For more details refer to:
@leo4all
leo4all / Language.php
Created February 15, 2017 19:23 — forked from remoblaser/Language.php
Language Middleware for Laravel
<?php
namespace App\Http\Middleware;
use Closure;
use Illuminate\Foundation\Application;
use Illuminate\Http\Request;
use Illuminate\Routing\Redirector;
use Illuminate\Support\Facades\App;
use Illuminate\Support\Facades\Config;
use Illuminate\Support\Facades\Session;
@leo4all
leo4all / bootstrap-modal-events.md
Created January 24, 2018 21:02 — forked from Simsso/bootstrap-modal-events.md
List of Bootstrap modal events with description
  • show.bs.modal: fired just before the modal is open.

  • shown.bs.modal: fired after the modal is shown.

  • hide.bs.modal: fired just before the modal is hidden.

  • hidden.bs.modal: fired after the modal is closed.

  • loaded.bs.modal: fired when remote content is successfully loaded in the modal’s content area using the remote option mentioned above.

@leo4all
leo4all / gulpfile.js
Created January 26, 2018 23:58 — forked from crusat/gulpfile.js
Gulp Example
// npm i -g gulp
// npm i gulp gulp-uglify gulp-rename gulp-concat gulp-header gulp-minify-css gulp-watch
var gulp = require('gulp'),
uglify = require('gulp-uglify'),
rename = require('gulp-rename'),
concat = require('gulp-concat'),
header = require('gulp-header'),
pkg = require('./package.json'),
minifyCSS = require('gulp-minify-css'),
watch = require('gulp-watch');