Skip to content

Instantly share code, notes, and snippets.

View KeithNdhlovu's full-sized avatar

Keith Ndhlovu KeithNdhlovu

View GitHub Profile
Snap.plugin(function (Snap, Element, Paper, glob) {
Paper.prototype.multitext = function (x, y, txt, max_width, attributes) {
var svg = Snap();
var abc = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
var temp = svg.text(0, 0, abc);
temp.attr(attributes);
var letter_width = temp.getBBox().width / abc.length;
svg.remove();
$(document).ready(function(){
var mobi = Snap("#livx-processes-mobi");
//Load Mobile Processes
if(mobi != null){
Snap.load("images/mobile/livx-process-mobile.svg", function ( f ) {
mobi.append( f.select("#content") );
});
}
$(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');
@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.
@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 / 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 / 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 / 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 / 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 / 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"