Skip to content

Instantly share code, notes, and snippets.

View einnar82's full-sized avatar
🎯
Doing nice things.

Rannie Ollit einnar82

🎯
Doing nice things.
View GitHub Profile
@einnar82
einnar82 / submit.md
Created December 8, 2020 05:10 — forked from tanaikech/submit.md
Upload Files to Google Drive using Javascript

Upload Files to Google Drive using Javascript

News

At October 11, 2019, I published a Javascript library to to run the resumable upload for Google Drive. When this is used, the large file can be uploaded. You can also use this js library.

Description

This is a sample script for uploading files to Google Drive using Javascript. The files are uploaded by Drive API v3. gapi.client.drive.files.create() can create an empty file on Google Drive. But it cannot directly upload files including contents. I think that this might not be able to upload files and metadata with the multipart/related, although this might be resolved by the future update. So now, as one of workarounds, I use using XMLHttpRequest.

  • This sample uses gapi.
  • Before you use this, please enable Drive API at API console and carr
@einnar82
einnar82 / build.yml
Last active November 25, 2020 01:12
Github actiions for Vue.js to AWS S3
name: S3 Deploy
on:
push:
branches:
- master
jobs:
build:
runs-on: ubuntu-latest
steps:
@einnar82
einnar82 / sample.conf
Last active August 13, 2020 09:41
Directory alias nginx
location /some-url/ {
alias /path/to/some/directory;
autoindex on;
autoindex_exact_size off;
autoindex_format html;
autoindex_localtime on;
}
@einnar82
einnar82 / gist:0d917d1819fbd330d339c4d92b80ff6c
Created July 14, 2020 07:11
Install composer on Amazon AMI running on EC2
$ cd ~
$ sudo curl -sS https://getcomposer.org/installer | sudo php
$ sudo mv composer.phar /usr/local/bin/composer
$ sudo ln -s /usr/local/bin/composer /usr/bin/composer
then you can run
$ sudo composer install
@einnar82
einnar82 / docker-compose.yml
Created July 9, 2020 05:15
Multiple database instance in docker-compose
services:
telescope-db:
image: mysql
command: --default-authentication-plugin=mysql_native_password
restart: always
environment:
MYSQL_ROOT_PASSWORD: example
app-db:
image: mysql
command: --default-authentication-plugin=mysql_native_password
@einnar82
einnar82 / docker-php-ext-install.md
Created July 8, 2020 23:58 — forked from giansalex/docker-php-ext-install.md
docker-php-ext-install Reference
RUN apt update
RUN apt upgrade -y
RUN apt install -y apt-utils
RUN a2enmod rewrite
RUN apt install -y libmcrypt-dev
RUN apt install -y libicu-dev
RUN docker-php-ext-install -j$(nproc) intl
RUN apt-get install -y libfreetype6-dev libjpeg62-turbo-dev libpng12-dev
RUN docker-php-ext-configure gd --with-freetype-dir=/usr/include/ --with-jpeg-dir=/usr/include/ 
@einnar82
einnar82 / Payment.php
Last active August 14, 2020 00:37
Proper exception handling in GuzzleHttp
<?php
namespace Foo\Bar;
use GuzzleHttp\Exception\RequestException;
use Guzzle\Http\Exception\ConnectException;
class Payment
{
public function request()
{
@einnar82
einnar82 / docker-compose.yml
Last active June 24, 2020 07:16
Sample docker-compose.yml
version: "3"
networks:
laravel:
services:
nginx:
image: nginx:stable-alpine
container_name: nginx
ports:
@einnar82
einnar82 / ExcelRule.php
Created May 13, 2020 01:16
Excel Validation Rule
<?php
namespace App\Rules\API;
use Illuminate\Contracts\Validation\Rule;
class ExcelRule implements Rule
{
/**
* Create a new rule instance.
@einnar82
einnar82 / README.md
Created May 9, 2020 02:39
Elasticsearch Basics
Elasticsearch RDBMS
Document Row
Type Column
Index Index

Cluster - collection of one or more nodes. Node - it has shards and replicas, it is the single instance of Elasticsearch Shard - distributor of data, it allows you to split data across different shards