Skip to content

Instantly share code, notes, and snippets.

View aindong's full-sized avatar
🎯
Focusing

Alleo Indong aindong

🎯
Focusing
View GitHub Profile
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 August 22, 2018 09:31
Download blob client side
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);
@aindong
aindong / FormGathererSpreadsheet.js
Created July 31, 2018 05:37
Save data to spreadsheet
// 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 July 10, 2018 03:34
Multi-Tenant Middleware Laravel
<?php namespace App\Http\Middleware;
use Closure;
use Illuminate\Config\Repository as Config;
class TenantDetector {
protected $config;
public function __construct(Config $config)
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 16:36
Get the query string from url using javascript es6
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, " "));
@aindong
aindong / AppStoryboard.swift
Created May 1, 2018 14:54 — forked from Gurdeep0602/AppStoryboard.swift
AppStoryboard enumeration
//
// AppStoryboards.swift
// AppStoryboards
//
// Created by Gurdeep on 15/12/16.
// Copyright © 2016 Gurdeep. All rights reserved.
//
import Foundation
import UIKit
@aindong
aindong / APIService.java
Created March 27, 2018 11:56
Sample response
@GET("/v1/categories")
void getMessages(Callback<BaseResponse<CategoriesResponse>> callback);
@aindong
aindong / gist:29910e4e9f5486c40515e14ee1c3a876
Created March 20, 2018 10:19
laravel-folder permission
sudo chgrp -R www-data storage bootstrap/cache
sudo chmod -R ug+rwx storage bootstrap/cache
@aindong
aindong / provision.sh
Last active June 13, 2019 12:57
provision laravel server with nginx, php, awscli, composer, node, ruby, python
#!/bin/bash
# Add Ruby2.0 respository
add-apt-repository -y ppa:brightbox/ruby-ng-experimental
# Add PHP 7.* ppa
sudo add-apt-repository ppa:ondrej/php
# Add node source respository
curl -sL https://deb.nodesource.com/setup_8.x | sudo -E bash -