Skip to content

Instantly share code, notes, and snippets.

View blogui91's full-sized avatar
🎯
Focusing

Cesar Santana blogui91

🎯
Focusing
  • Doorvel
  • Monterrey
  • 22:03 (UTC -06:00)
View GitHub Profile
function readDir(start, callback) {
// Use lstat to resolve symlink if we are passed a symlink
fs.lstat(start, function(err, stat) {
if(err) {
return callback(err);
}
var found = {dirs: [], files: []},
total = 0,
processed = 0;
function isDir(abspath) {
/*http://i-skool.co.uk/mobile-development/web-design-for-mobiles-and-tablets-viewport-sizes/*/
/*At least requires the meta viewport tag with content 'width=device-width'*/
@media only screen and (max-width: 1080px) and (orientation : portrait) {
/* PORTRAIT:
Windows Surface Pro*/
}
@media only screen and (max-width: 800px) and (orientation : portrait) {
/* PORTRAIT:
Acer Iconia Tab A100
@blogui91
blogui91 / README
Created June 16, 2016 03:07 — forked from adilapapaya/README
Export Table Data to CSV using Javascript
Example code for exporting data in a table to a csv file.
@blogui91
blogui91 / Materialize CSS - Modal Fixed Header
Created November 8, 2016 20:06 — forked from nate-strauser/Materialize CSS - Modal Fixed Header
How to have a fixed modal header with materializecss
Modal Markup:
<div class="modal modal-fixed-header">
<div class="modal-header">
HEADER CONTENT
</div>
<div class="modal-content">
MAIN CONTENT
</div>
</div>
@blogui91
blogui91 / json-to-csv.php
Created November 9, 2016 06:59 — forked from Kostanos/json-to-csv.php
Convert JSON array file to CSV. Use the array keys as the first row. Command line using: json-to-csv.php json.filename > csv.filename
#!/usr/bin/php
<?php
/*
* Convert JSON file to CSV and output it.
*
* JSON should be an array of objects, dictionaries with simple data structure
* and the same keys in each object.
* The order of keys it took from the first element.
*
* Example:
@blogui91
blogui91 / 01_Laravel 5 Simple ACL manager_Readme.md
Created December 7, 2016 04:19 — forked from amochohan/01_Laravel 5 Simple ACL manager_Readme.md
Laravel 5 Simple ACL - Protect routes by an account / role type

#Laravel 5 Simple ACL manager

Protect your routes with user roles. Simply add a 'role_id' to the User model, install the roles table and seed if you need some example roles to get going.

If the user has a 'Root' role, then they can perform any actions.

Installation

Simply copy the files across into the appropriate directories, and register the middleware in App\Http\Kernel.php

/*
var Trait1 = {
method1() {}
};
var Trait2 = {
method2() {}
};
var Trait3 = mixin({
@blogui91
blogui91 / javascript aspect ratio calculation (with GCD)
Created May 17, 2017 17:30 — forked from phobeo/javascript aspect ratio calculation (with GCD)
javascript aspect ratio calculation algorithm (take the GCD and divide both elements of resolution)
/* euclidean GCD (feel free to use any other) */
function gcd(a,b) {if(b>a) {temp = a; a = b; b = temp} while(b!=0) {m=a%b; a=b; b=m;} return a;}
/* ratio is to get the gcd and divide each component by the gcd, then return a string with the typical colon-separated value */
function ratio(x,y) {c=gcd(x,y); return ""+(x/c)+":"+(y/c)}
/* eg:
> ratio(320,240)
"4:3"
> ratio(360,240)
@blogui91
blogui91 / CORS.php
Created June 13, 2017 00:35 — forked from fhferreira/CORS.php
Try to create - Cors Filter Laravel 5 Middleware
<?php namespace App\Http\Middleware;
use Closure;
use Illuminate\Contracts\Routing\Middleware;
use Illuminate\Http\Response;
class CORS implements Middleware {
/**
* Handle an incoming request.
@blogui91
blogui91 / ConfiguraProyectoLaravelServidor.md
Created August 30, 2017 18:41
Preparar Servidor NGINX, SERVER UBUNTU
  1. git init
  2. git remote add origin [email protected]:indexreynosa/website.git
  3. git pull origin master
  4. git branch --set-upstream-to=origin/master //Para que solo tenga que hacer git pull despues y no se muestren como modificados lso archivos
  5. composer install
  6. cp .env.example .env
  7. php artisan key:generate
  8. chown -R www-data.www-data /var/www/heddiefranco.com

Nota: primero generar las ssh keys en el servidor ssh-keygen -t rsa y luego agregarlas a mi cuenta de bitbucket https://bitbucket.org/account/user/HFranco_/ssh-keys/