Skip to content

Instantly share code, notes, and snippets.

View McKabue's full-sized avatar

Kabue Charles McKabue

View GitHub Profile
@McKabue
McKabue / jQuery plugin to dynamically register events on dynamically added items ondemand
Last active September 28, 2015 09:08
jQuery plugin to dynamically register events on dynamically added items ondemand
(function ($) {
$.fn.EventHandler = function (options) {
var defaults = $.extend({}, options), $element, $eventsArray = [], $activityArray = [];
$element = $(this);
if (options.onEvent.length != 0) {
if(options.startEvent){
@McKabue
McKabue / JSON Path
Created May 10, 2016 12:09
This is a javascript function that traverses a JSON object however deep it is... This is important when you want to do a search on each of the elements of an object, see here https://jsfiddle.net/kyk5zf6y/
var o = {
"firstName": "John",
"lastName" : "doe",
"age" : 26,
"arr":[1,2,3],
"address" : {
"streetAddress": "naist street",
"city" : "Nara",
"postalCode" : "630-0192"
},
@McKabue
McKabue / Knockout.js Custom Binding for Minimalist Developer Calendar.js
Last active January 6, 2017 14:45
+this is an lightweight, simple, extensible jQuery plugin that just outputs a calendar the way a developer wants. it supports templating, adding events, in short, THIS IS THE PLUGIN YOU REFER AND/OR EXTEND WHEN YOU WANT TO CREATE A FULLY GROWN CALENDAR
ko.bindingHandlers.kocalender = {
init: function (element, valueAccessor, allBindingsAccessor, viewModel) {
var value = valueAccessor(),
instanceOptions = $.extend({
previousYearSelector: ".previousyear",
nextYearSelector: ".nextyear",
previousMonthSelector: ".previousmonth",
nextMonthSelector: ".nextmonth",
eventTemplate: '<div data-id="{{id}}" class="event">{{name}}</div>',
dateCallbacks: [
@McKabue
McKabue / Vue.js Lessons and Features I would love to see.md
Last active March 15, 2018 08:43
`Vue.js Lessons and Features I would love to see` is a compilation of experiences from other similar frameworks. I really like the fact that vue.js keeps HTML as HTML, JavaScript as Javascript and CSS as CSS, Its flexible, Clean syntax, and its more of a library than a framework
@McKabue
McKabue / JavaScript_Fullscreen_Helper_Method.js
Last active May 13, 2018 08:50
JavaScript Fullscreen Helper Method
if (!Element.prototype.fullScreen) {
var full_screen = function (element) {
var self = this;
this.change = null;
var isFullScreen = this.isFullScreen = function () {
return (document.fullScreen || document.mozFullScreen || document.webkitIsFullScreen || document.msFullscreenElement) ? true : false;
};
this.requestFullScreen = function () { //https://stackoverflow.com/a/33768712
// Supports most browsers and their versions.
@McKabue
McKabue / How_to_set_min_font_size_in_CSS.css
Last active May 19, 2018 19:00
How to set min-font-size in CSS :: https://stackoverflow.com/a/37836926 . This is because the static part of calc() defines the minimum. Even though the dynamic part might shrink to something near 0.
font-size:calc(12px + 1.5vw);
/*
* How to set min-font-size in CSS
* https://stackoverflow.com/a/37836926
* This is because the static part of calc() defines the minimum.
* Even though the dynamic part might shrink to something near 0.
*/
@McKabue
McKabue / Simple_HTML5_history_API_wrapper.js
Created May 22, 2018 06:34
This little gem ensures a consistent update of the browser history (both url and title) in an Single Page Application in a conventional manner
if ('history' in window) {
window.history.__pushState = window.history.pushState;
window.history.pushState = function (_data, _title, _url) {
window.history.__pushState(null, null, _url);
window.document.title = _title;
};
window.history.__replaceState = window.history.replaceState;
window.history.replaceState = function (_data, _title, _url) {
window.history.__replaceState(null, null, _url);
@McKabue
McKabue / HeidiDecode.js
Created May 31, 2018 21:17 — forked from jpatters/HeidiDecode.js
Decodes a password from HeidiSQL. HeidiSQL passwords can be found in the registry. Use File -> Export Settings to dump all settings. Great for if you forget a password.
function heidiDecode(hex) {
var str = '';
var shift = parseInt(hex.substr(-1));
hex = hex.substr(0, hex.length - 1);
for (var i = 0; i < hex.length; i += 2)
str += String.fromCharCode(parseInt(hex.substr(i, 2), 16) - shift);
return str;
}
document.write(heidiDecode('755A5A585C3D8141786B3C385E3A393'));
@McKabue
McKabue / visor-archivos-online.md
Created June 8, 2018 15:11 — forked from izazueta/visor-archivos-online.md
Google Docs Viewer & Office Web Apps Viewer

Google Docs Viewer

Only files under 25 MB can be previewed with the Google Drive viewer.

Google Drive viewer helps you preview over 16 different file types, listed below:

  • Image files (.JPEG, .PNG, .GIF, .TIFF, .BMP)
  • Video files (WebM, .MPEG4, .3GPP, .MOV, .AVI, .MPEGPS, .WMV, .FLV)
  • Text files (.TXT)
  • Markup/Code (.CSS, .HTML, .PHP, .C, .CPP, .H, .HPP, .JS)
  • Microsoft Word (.DOC and .DOCX)
@McKabue
McKabue / setting_minimum_and_maximum_CSS_values_for_font-size_padding_margin_and_may_more_not_just_height_and_width.scss
Last active June 20, 2018 06:56
Setting Minimum and maximum CSS values for `font-size`, `padding`, `margin`, and many more not just `height` and `width`
//
// https://stackoverflow.com/a/40530033
//
// ----
// libsass (v3.3.6)
// ----
// =========================================================================
//
// PRECISE CONTROL OVER RESPONSIVE TYPOGRAPHY FOR SASS