Skip to content

Instantly share code, notes, and snippets.

View aindong's full-sized avatar
🎯
Focusing

Alleo Indong aindong

🎯
Focusing
View GitHub Profile
// Create a new interface
public interface UIUpdatable {
public void updateUI(String message);
}
// Implement the new interface on the activity
public class QuestionNew extends AppCompatActivity implements UIUpdatable {
public TextView txtView;
@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,
@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 / 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 / WeekNumber.js
Last active March 23, 2017 16:08
Get the week number of a selected date
// Hacking javascript to get the week number of a selected date
Date.prototype.getWeek = function() {
var date = new Date(this.getTime());
date.setHours(0, 0, 0, 0);
// Thursday in current week decides the year.
date.setDate(date.getDate() + 3 - (date.getDay() + 7) % 7);
// January 4 is always in week 1.
var week1 = new Date(date.getFullYear(), 0, 4);
// Adjust to Thursday in week 1 and count number of weeks from date to week1.
return 1 + Math.round(((date.getTime() - week1.getTime()) / 86400000
#!/usr/bin/env bash
if [ -z $1 ]
then
echo "serve www.domain.com /path"
exit 1
fi
if [ -z $2 ]
then
@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 / 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 / line-break.css
Created October 12, 2017 08:46
line break on print media css
@media print {
.break {page-break-after: always;}
}
@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) {