Skip to content

Instantly share code, notes, and snippets.

View aindong's full-sized avatar
🎯
Focusing

Alleo Indong aindong

🎯
Focusing
View GitHub Profile
@aindong
aindong / magic_square.py
Created March 3, 2018 15:10
My dirty solution to magic square problem
import argparse
from math import floor
def main():
parser = argparse.ArgumentParser()
parser.add_argument("size", help="The size of the square. Please only input odd numbers")
args = parser.parse_args()
size = int(args.size)
@aindong
aindong / PolylineAnimation.js
Last active January 25, 2018 08:32
Google Map Polyline animation
let gpsPath = []
let step = 0
let stepIncrement = 1
let numSteps = locations.length - 1
let timePerStep = 300
let interval = setInterval(() => {
step += stepIncrement
if (step >= numSteps) {
@aindong
aindong / line-break.css
Created October 12, 2017 08:46
line break on print media css
@media print {
.break {page-break-after: always;}
}
@aindong
aindong / laravel-permission.sh
Created October 10, 2017 17:10
normalize laravel permission for security and fixing logging issues of permission denied
#!/bin/bash
## create user group
sudo groupadd laravel
## add current user to group
sudo usermod -a -G www-data $USER
## add web server to group
sudo usermod -a -G www-data laravel
@aindong
aindong / draw_box
Created August 18, 2017 10:17
draw target like graphics on face
cv2.line(Image, (x, y), (x + (w/5) ,y), WHITE, 2)
cv2.line(Image, (x+((w/5)*4), y), (x+w, y), WHITE, 2)
cv2.line(Image, (x, y), (x, y+(h/5)), WHITE, 2)
cv2.line(Image, (x+w, y), (x+w, y+(h/5)), WHITE, 2)
cv2.line(Image, (x, (y+(h/5*4))), (x, y+h), WHITE, 2)
cv2.line(Image, (x, (y+h)), (x + (w/5) ,y+h), WHITE, 2)
cv2.line(Image, (x+((w/5)*4), y+h), (x + w, y + h), WHITE, 2)
cv2.line(Image, (x+w, (y+(h/5*4))), (x+w, y+h), WHITE, 2)
@aindong
aindong / API.md
Created April 18, 2017 10:05 — forked from iros/API.md
Documenting your REST API

Title

<Additional information about your API call. Try to use verbs that match both request type (fetching vs modifying) and plurality (one vs multiple).>

  • URL

    <The URL Structure (path only, no root url)>

  • Method:

@aindong
aindong / export.swift
Last active January 8, 2023 20:23
Export Core Data into CSV in Swift 3
func createExportString() -> String {
var name : String?
var age : String?
var mobile : String?
var email : String?
var promo_crayola_bunding : Int16?
var promo_zip_it : Int16?
var promo_none : Int16?
var created : NSDate? = NSDate()
@aindong
aindong / helper.php
Created February 25, 2017 00:06
make current nagivation link active
//throw this in your helper.php
function set_active($path, $active = 'active') {
return call_user_func_array('Request::is', (array)$path) ? $active : '';
}
// use it like so
<a class="{{ set_active(['admin/institutes*','admin/courses*']) }}">Learning</a>
@aindong
aindong / actionTypes.js
Created February 10, 2017 17:52
action type factory for react redux
export default function createActionTypes(entityName) {
const ENTITY = entityName.toUpperCase();
return {
LOAD_START: `LOAD_${ENTITY}S_START`,
LOAD_SUCCESS: `LOAD_${ENTITY}S_SUCCESS`,
LOAD_NO_CONNECTION: `LOAD_${ENTITY}S_NO_CONNECTION`,
LOAD_ERROR: `LOAD_${ENTITY}S_ERROR`,
@aindong
aindong / smoothScroll.js
Created February 10, 2017 17:50
Smooth Scroll Utility Helper for ReactJs or JS applications
export const smoothScroll = {
timer: null,
stop: function () {
clearTimeout(this.timer);
},
scrollTo: function (id, callback) {
let settings = {
duration: 1000,