Skip to content

Instantly share code, notes, and snippets.

View mitzerh's full-sized avatar

Helcon Mabesa mitzerh

View GitHub Profile
@mitzerh
mitzerh / fiddle.css
Created September 18, 2014 14:33
Preloading Images
div.pic img {
width: 75px;
height: 81px;
background-color: #ccc;
}
@mitzerh
mitzerh / fiddle.css
Last active August 29, 2015 14:06
Pagination Script (RAW)
body {
font-family: "tahoma";
}
ul {
margin: 0;
padding: 0;
position: relative;
}
@mitzerh
mitzerh / fiddle.css
Last active August 29, 2015 14:08
AngularJS : Multiple sets of dropdowns
li { display:none;}
li.show { display: block;}
@mitzerh
mitzerh / fiddle.html
Created October 23, 2014 01:56
Countdown Timer
<div>dy : hr : mn : sec</div>
<div id="timer"></div>
@mitzerh
mitzerh / fiddle.js
Last active August 29, 2015 14:08
Query String Helper
var QueryParam = (function(){
var App = function() {
};
var Proto = App.prototype;
// get specific query param value
Proto.getVal = function(name) {
@mitzerh
mitzerh / fiddle.js
Created October 24, 2014 04:14
Query String Helper: Sample
var render = function(id, val) {
document.getElementById(id).innerHTML = val;
};
render("get-val-1", QueryParam.getVal("foo"));
render("get-all-1",
(function(){
@mitzerh
mitzerh / script.js
Last active August 29, 2015 14:08
Current Time: Sample get server time
// sample - using a simple server timestamp; using jQuery JSON call
// Eastern Time
var REQ_ET = $.ajax({
url: "/dev/us-time/now/et.php",
dataType: "json",
cache: true
}).done(function(data){
window.CURRENT_TIME_ET = new CurrentTimer(new Date(data.server));
@mitzerh
mitzerh / server-time.php
Created November 2, 2014 18:06
Current Time: Sample PHP server time
<?php
// sample script to return the server time in json output
header('Content-Type: application/json');
date_default_timezone_set('US/Eastern'); //server time zone
echo '{ "server": "' . date('m-d-Y H:i:s') . '" }';
?>
@mitzerh
mitzerh / ParseTweet.js
Last active August 29, 2015 14:13
Parse Tweet String
var ParseTweetText = function(text) {
// link
text = text.replace(/(http|https):\/\/\S+/gi, function(val) {
return '<a target="_blank" href="'+val+'">'+val+'</a>';
});
// user_name
text = text.replace(/@[A-Z0-9\-\_]+/gi, function(val) {
return '<a target="_blank" href="https://twitter.com/'+val.slice(1)+'">'+val+'</a>';
@mitzerh
mitzerh / .jshintrc
Last active August 29, 2015 14:14 — forked from haschek/.jshintrc
{
// --------------------------------------------------------------------
// JSHint Configuration, Strict Edition
// --------------------------------------------------------------------
//
// This is a options template for [JSHint][1], using [JSHint example][2]
// and [Ory Band's example][3] as basis and setting config values to
// be most strict:
//
// * set all enforcing options to true