Skip to content

Instantly share code, notes, and snippets.

View KeithNdhlovu's full-sized avatar

Keith Ndhlovu KeithNdhlovu

View GitHub Profile
@KeithNdhlovu
KeithNdhlovu / GoogleMapsDirections.java
Created July 7, 2016 12:37
how to launch google maps directions API
Uri gmmIntentUri = Uri.parse(String.format(Locale.US, "google.navigation:q=%f,%f", panicLocation.latitude, panicLocation.longitude));
Intent mapIntent = new Intent(Intent.ACTION_VIEW, gmmIntentUri);
mapIntent.setPackage("com.google.android.apps.maps");
startActivity(mapIntent);
@KeithNdhlovu
KeithNdhlovu / WhatsDom.js
Created June 9, 2016 12:07
Since Whatsap Doesnt have an Option to Export contacts in a group, and they only display username, and status, exporting contacts out of one group is straneous, so i made this
var groupList = document.getElementsByClassName("infinite-list-viewport")[0];
var contactList = groupList.getElementsByClassName("infinite-list-item");
var users = [];
for(var cc = 0; cc < contactList.length; cc++){
var name = contactList[cc].getElementsByClassName("chat-title")[0].getElementsByTagName("span")[0].getAttribute("title");
var contactDOM = contactList[cc].getElementsByClassName("chat-title")[0].getAttribute("data-reactid");
var reallNumber = contactDOM.replace(".0.0:$main.3.2.$=10.1:1.2.1:1.0.0.$", "");
reallNumber = reallNumber.substr(0, reallNumber.indexOf("@c=1us"));
@KeithNdhlovu
KeithNdhlovu / AngualarMaterialisecssData.json
Last active May 20, 2016 10:47
I Noticed that MaterializeCSS used the Select box, faster than my AngularJS script, by the time agular is finished the select box would have already been initialised
{"es_data": [
{
"id" : "1",
"state": "OH",
"gender": "female"
},
{
"id" : "2",
"state": "NY",
"gender": "male"
@KeithNdhlovu
KeithNdhlovu / d3-plugins.js
Created February 29, 2016 10:33
Moove objects Above other objects
d3.selection.prototype.moveToFront = function() {
return this.each(function(){
this.parentNode.appendChild(this);
});
};
d3.selection.prototype.moveToBack = function() {
return this.each(function() {
var firstChild = this.parentNode.firstChild;
if (firstChild) {
@KeithNdhlovu
KeithNdhlovu / ReadMe.md
Created February 26, 2016 06:33
Instructions to deploying a sub folder site in github pages

Deploying a subfolder to GitHub Pages

Sometimes you want to have a subdirectory on the master branch be the root directory of a repository’s gh-pages branch. This is useful for things like sites developed with Yeoman, or if you have a Jekyll site contained in the master branch alongside the rest of your code.

For the sake of this example, let’s pretend the subfolder containing your site is named dist.

Step 1

Remove the dist directory from the project’s .gitignore file (it’s ignored by default by Yeoman).

@KeithNdhlovu
KeithNdhlovu / arrow.css
Last active February 22, 2016 08:16
CSS Triangle
.arrow-right {
width: 0;
height: 0;
border-top: 60px solid transparent;
border-bottom: 60px solid transparent;
border-left: 60px solid green;
}
@KeithNdhlovu
KeithNdhlovu / D3SideBySideBarGraph.html
Created February 12, 2016 10:44
This is D3 Chart which shows the bar graph side by side
<!DOCTYPE html>
<html>
<head>
<title>Bar Chart</title>
<script type="text/javascript" src="javascript/d3.v2.min.js"></script>
<style type="text/css">
.chart {
background: #00ccff;
margin: 10px;
padding-top: 10px;
@KeithNdhlovu
KeithNdhlovu / LiVBrowserDetect.js
Created February 9, 2016 19:08
This script helps check which browser is runing your site
var BrowserDetect = {
init: function () {
this.browser = this.searchString(this.dataBrowser) || "Other";
this.version = this.searchVersion(navigator.userAgent) || this.searchVersion(navigator.appVersion) || "Unknown";
},
searchString: function (data) {
for (var i = 0; i < data.length; i++) {
var dataString = data[i].string;
this.versionSearchString = data[i].subString;
@KeithNdhlovu
KeithNdhlovu / SVGContent.svg
Created February 8, 2016 09:31
LivContentSlider using SnapSVG
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
$(function() {
$('a.page-scroll').bind('click', function(event) {
var $anchor = $(this);
//This implementation requires JQueryEasing plugin to work [http://cdnjs.cloudflare.com/ajax/libs/jquery-easing/1.3/jquery.easing.min.js]
$('html, body').stop().animate({
scrollTop: $($anchor.attr('href')).offset().top - 90
}, 1500, 'easeInOutExpo');