Skip to content

Instantly share code, notes, and snippets.

Avatar
🎯
Focusing

Alleo Indong aindong

🎯
Focusing
View GitHub Profile
@aindong
aindong / main.dart
Created Jul 16, 2019
MiCard Flutter Practice
View main.dart
import 'package:flutter/material.dart';
void main() {
runApp(MyApp());
}
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
@aindong
aindong / deploy_to_s3_and_cf.sh
Created Jun 20, 2019
Build and deploy a create-react-app to s3 and cloudfront
View deploy_to_s3_and_cf.sh
#!/bin/bash
## Colors for cli output messages
ERROR=`tput setaf 1`
SUCCESS=`tput setaf 2`
PC=`tput setaf 3`
NC=`tput sgr0`
## Available choices on args
## You can create as many project as you like for choices
@aindong
aindong / getVideoDuration.js
Created Nov 21, 2018
Get local video duration using promise
View getVideoDuration.js
const getDuration = file => {
return new Promise((resolve, reject) => {
let videoElement = document.createElement("video");
videoElement.preload = "metadata";
videoElement.onloadedmetadata = function() {
window.URL.revokeObjectURL(videoElement.src);
resolve(videoElement.duration);
};
@aindong
aindong / aws-policy.json
Last active Nov 13, 2018
React-S3-CloudFront Deployment Shell Script
View aws-policy.json
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "Stmt1489770487230",
"Effect": "Allow",
"Principal": {
"AWS": "arn user"
},
"Action": [
View id-en-all.geo.json
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@aindong
aindong / downloader.js
Last active Aug 22, 2018
Download blob client side
View downloader.js
const download = blob => {
if (window.navigator.msSaveOrOpenBlob) { // IE hack; see http://msdn.microsoft.com/en-us/library/ie/hh779016.aspx
window.navigator.msSaveBlob(blob, "filename.csv");
} else {
let a = window.document.createElement("a");
a.href = window.URL.createObjectURL(blob, {type: "text/plain"});
a.download = "filename.csv";
document.body.appendChild(a);
a.click(); // IE: "Access is denied"; see: https://connect.microsoft.com/IE/feedback/details/797361/ie-10-treats-blob-url-as-cross-origin-and-denies-access
document.body.removeChild(a);
View FormGathererSpreadsheet.js
// https://script.google.com/macros/s/AKfycbxqaARMsIrSYKysoN5RByYe0PlWAgW9VrRi16p8IojhFKpgYpc/exec
function doGet(e){
//return handleResponse(e);
}
function doPost(e){
return handleResponse(e);
}
@aindong
aindong / TenantDetector.php
Last active Jul 10, 2018
Multi-Tenant Middleware Laravel
View TenantDetector.php
<?php namespace App\Http\Middleware;
use Closure;
use Illuminate\Config\Repository as Config;
class TenantDetector {
protected $config;
public function __construct(Config $config)
View code_breaker.py
import random
def main():
# Generate digits
code = generate_digits(3, [])
print(code)
# Some story
print("Welcome to CodeBreaker Game, You need to unlock something before something happened")
print("Can you guess the code to unlock that something?")
@aindong
aindong / GetQueryString.js
Created May 6, 2018
Get the query string from url using javascript es6
View GetQueryString.js
var qs = (function(a) {
if (a == "") return {};
var b = {};
for (var i = 0; i < a.length; ++i)
{
var p=a[i].split('=', 2);
if (p.length == 1)
b[p[0]] = "";
else
b[p[0]] = decodeURIComponent(p[1].replace(/\+/g, " "));