Skip to content

Instantly share code, notes, and snippets.

View elminson's full-sized avatar

Elminson De Oleo Baez elminson

View GitHub Profile
@elminson
elminson / input.txt
Last active August 29, 2015 14:22
Get Original Files
4
jfjr959493ajsks999s9_A.txt
sieeke4444abcksl4krk_A.cpp
a8b95b8k4ra9f4ka92kf_A.cs
A.java
@elminson
elminson / user.js
Created December 3, 2018 15:56 — forked from EtienneR/user.js
XMLHttpRequest RESTful (GET, POST, PUT, DELETE)
// Get all users
var url = "http://localhost:8080/api/v1/users";
var xhr = new XMLHttpRequest()
xhr.open('GET', url, true)
xhr.onload = function () {
var users = JSON.parse(xhr.responseText);
if (xhr.readyState == 4 && xhr.status == "200") {
console.table(users);
} else {
console.error(users);
@elminson
elminson / icons.scss
Created March 13, 2019 18:00 — forked from chipcullen/icons.scss
My power duo for dealing with icons and SASS - an extendable %icon that references your icon font. The mixin then allows you to specify the content (the unicode string for the icon), and optionally 'before' or 'after' which creates the respective pseudo element. #icons #iconfonts #scss
%icon {
font-family: $icon-font; //set as a variable - it's whatever your icon font name is
speak: none;
font-weight: normal;
font-variant: normal;
text-transform: none;
line-height: 1;
-webkit-font-smoothing: antialiased;
}
@elminson
elminson / sort-object-properties-by-value.md
Created April 9, 2019 13:39 — forked from umidjons/sort-object-properties-by-value.md
JavaScript: sort object properties by value (numeric or string)

Sort object properties by value (values are text)

I have following object:

var cities={10:'Tashkent', 14:'Karakalpakiya', 16:'Andijan'};

I want sort it by city names, so after sort it should be:

var cities={16:'Andijan', 14:'Karakalpakiya', 10:'Tashkent'};

But I can't sort object properties, instead can convert object into array, then sort items.

@elminson
elminson / hash_table.php
Created May 2, 2019 04:56 — forked from meetrajesh/hash_table.php
Basic implementation of a hash table in PHP with collision detection and management (no locking support)
<?php
class HashTable {
private $_array = array();
private $_size = 10000;
public function __construct($size=0) {
$size = (int)$size;
if ($size > 0) {
@elminson
elminson / update_php_7.3_debian_9.txt
Created June 18, 2019 15:59
update php 7.3 debian 9
sudo apt install ca-certificates apt-transport-https
wget -q https://packages.sury.org/php/apt.gpg -O- | sudo apt-key add -
echo "deb https://packages.sury.org/php/ stretch main" | sudo tee /etc/apt/sources.list.d/php.list
sudo apt update
sudo apt install php7.3 php7.3-cli php7.3-common php7.3-curl php7.3-mbstring php7.3-mysql php7.3-xml php7.3-gd
sudo apt-get purge php7.0-common
sudo apt install phpmyadmin*
sudo a2enmod php7.3
sudo /etc/init.d/apache2 restart

Commands to deploy Laravel API App in GCP

in the console after deploy LAMP Certified by Bitnami

Install the project

cd /opt/bitnami/apache2/htdocs

sudo git clone https://github.com/elminson/gc_lamp_laravel.git todo

cd todo

sudo composer install

<?php
/**
* Created by PhpStorm.
* User: elminsondeoleo
* Date: 2019-12-23
* Time: 22:13
*/
/**
@elminson
elminson / README.md
Created December 24, 2019 14:33 — 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

<?php
/**
* Allow pretty print with the query parameter ?pretty=true
*/
declare(strict_types=1);
namespace App\Http\Middleware;
use Illuminate\Http\JsonResponse;