Skip to content

Instantly share code, notes, and snippets.

View JenkinsDev's full-sized avatar
🏠
Working from home

David JenkinsDev

🏠
Working from home
View GitHub Profile
@JenkinsDev
JenkinsDev / fadein
Last active August 29, 2015 14:12
fadeOut and fadeIn elements with JS (Drop In)
Element.prototype.fadeIn = function(callback) {
var ele = this,
opacity = ele.style.opacity = Number(ele.style.opacity) || 0.0,
fadeInLoop = null,
intervalTime = 10,
opacityAmount = 0.05;
ele.style.display = 'block';
// If the opacity is already greater than or equal to zero then there is nothing
@JenkinsDev
JenkinsDev / calculate_age
Created June 6, 2014 00:09
Calculate Age (One Liner)
$age = floor((time() - strtotime($data_of_birth)) / 31556926);
@JenkinsDev
JenkinsDev / AsyncTaskHelp.java
Created November 10, 2013 20:23
Basic AsyncTask layout that I point people to when they are confused.
public class MyAsyncTaskName extends AsyncTask<String, Integer, String> {
// String: The first string is the parameter, this is what is passed to doInBackground()
// Integer: The first, and only, Integer type is used for progress updates, this is what is passed to onProgressUpdate()
// String: The second String is for what is returned by doInBackground() and what is passed to onPostExecution();
@Override
protected void onPreExecute() {
// Handles what happens before the AsyncTask fully executes.
// Here you can do things like add a progress bar, loading animation, etc.