Skip to content

Instantly share code, notes, and snippets.

View blogui91's full-sized avatar
🎯
Focusing

Cesar Santana blogui91

🎯
Focusing
  • Doorvel
  • Monterrey
  • 00:59 (UTC -06:00)
View GitHub Profile
@blogui91
blogui91 / gist:90859fb318f358876187a5a1fde2dacc
Created February 11, 2020 23:56 — forked from alisterlf/gist:3490957
JAVASCRIPT:Remove Accents
function RemoveAccents(strAccents) {
var strAccents = strAccents.split('');
var strAccentsOut = new Array();
var strAccentsLen = strAccents.length;
var accents = 'ÀÁÂÃÄÅàáâãäåÒÓÔÕÕÖØòóôõöøÈÉÊËèéêëðÇçÐÌÍÎÏìíîïÙÚÛÜùúûüÑñŠšŸÿýŽž';
var accentsOut = "AAAAAAaaaaaaOOOOOOOooooooEEEEeeeeeCcDIIIIiiiiUUUUuuuuNnSsYyyZz";
for (var y = 0; y < strAccentsLen; y++) {
if (accents.indexOf(strAccents[y]) != -1) {
strAccentsOut[y] = accentsOut.substr(accents.indexOf(strAccents[y]), 1);
} else
@blogui91
blogui91 / build.gradle
Created January 26, 2019 22:15 — forked from jkasten2/build.gradle
OneSignalSDK version matching error when using google-services plugin
//App build.gradle
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
apply plugin: 'com.onesignal.androidsdk.onesignal-gradle-plugin'
android {
compileSdkVersion 27
<?php
/*
* Converts CSV to JSON
* Example uses Google Spreadsheet CSV feed
* csvToArray function I think I found on php.net
*/
header('Content-type: application/json');
// Set your CSV feed
@blogui91
blogui91 / pivot_example.php
Created August 30, 2018 21:30 — forked from fractefactos/pivot_example.php
Laravel Custom Pivot Model definition example
<?php
//https://github.com/laravel/framework/issues/2093#issuecomment-39154456
use Illuminate\Database\Eloquent\Model as Eloquent;
use Illuminate\Database\Eloquent\Relations\Pivot;
class User extends Eloquent {
public function groups() {
return $this->belongsToMany('Group');
@blogui91
blogui91 / README.md
Created March 8, 2018 16:39 — forked from pbojinov/README.md
Two way iframe communication- Check out working example here: http://pbojinov.github.io/iframe-communication/

Two way iframe communication

The main difference between the two pages is the method of sending messages. Recieving messages is the same in both.

Parent

Send messages to iframe using iframeEl.contentWindow.postMessage Recieve messages using window.addEventListener('message')

iframe

@blogui91
blogui91 / LICENSE
Created March 5, 2018 02:24 — forked from ifraixedes/LICENSE
Private properties on ES6 Classes using Proxies
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE Version 2, December 2004
(http://www.wtfpl.net/about/)
Copyright (C) 2015 Ivan Fraixedes (https://ivan.fraixed.es)
Everyone is permitted to copy and distribute verbatim or modified
copies of this license document, and changing it is allowed as long
as the name is changed.
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
@blogui91
blogui91 / ConfiguraProyectoLaravelServidor.md
Created August 30, 2017 18:41
Preparar Servidor NGINX, SERVER UBUNTU
  1. git init
  2. git remote add origin git@bitbucket.org: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/

@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 / 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)
/*
var Trait1 = {
method1() {}
};
var Trait2 = {
method2() {}
};
var Trait3 = mixin({