Skip to content

Instantly share code, notes, and snippets.

@KazChe
KazChe / padolsys.js
Created May 25, 2012 07:08 — forked from padolsey/gist:527683
detects ie
// ----------------------------------------------------------
// A short snippet for detecting versions of IE in JavaScript
// without resorting to user-agent sniffing
// ----------------------------------------------------------
// If you're not in IE (or IE version is less than 5) then:
// ie === undefined
// If you're in IE (>=5) then you can determine which version:
// ie === 7; // IE7
// Thus, to detect IE:
// if (ie) {}
@KazChe
KazChe / LabesFromID.js
Created August 8, 2012 16:16
get label's value from id - error message issue
labels = document.getElementsByTagName('label');
len = labels.length;
for(var i = 0; i < len; i++) {
if(labels[i].htmlFor == elementId) {
errLabel= labels[i].innerHTML;
}
}
@KazChe
KazChe / Tabs_Modifications_POC.html
Created August 9, 2012 16:57
poc for modifying other pages to use Tabs
<li><a href="/campaignManagerWeb/mb/createsmspushoffer">Create .....</a></li>
<!-- add the above to the ul and no div container for it -->
<!-- issues: 1.cmsleftmenu.jsp taken out 2.pagination calls must be turned to ajax calls in order to keep content within tab otherwise goes to page -->
@KazChe
KazChe / gist:6905107
Created October 9, 2013 17:37
nodejs - easy way to upgrade an existing install
> sudo npm cache clean -f
> sudo npm install -g n
> sudo n stable <or specific version>
@KazChe
KazChe / gist:6930300
Created October 11, 2013 06:16
Checking in existing local code into a repository already created via web console.
git init
git add .
git status
git commit -m"inital checkin"
git remote add origin https://github.com/<UID>/<REPO_NAME>
git pull origin master
@KazChe
KazChe / gist:6930781
Created October 11, 2013 07:15
Checkin steps
git add .
git status
commit -m"blah blurb boop"
git push origin master
@KazChe
KazChe / gist:6954708
Last active December 25, 2015 09:29
simple Object.observe() - run in Chrome Canary with experimental javascript flag enabled.
function ObserveMe() {
var x =
{
"thing":
{ "label": "party",
"value": "republican"
}
}
return x;
}
@KazChe
KazChe / gist:9110375
Created February 20, 2014 10:02
blog snippet1
<html ng-app='q.apApp'>
<form name="gonebatty" ng-app="q.apApp" ng-controller='AppController' method="post" novalidate>
<label>Header Font Color:</label>
<input type="text" id="font-color" ng-model="homePageHeaderFontColor"
hexadecimal-color-validation={{homePageHeaderFontColor}}>
<span ng-show="gonebatty.homePageHeaderFontColor.$error.validHexColor" class="errorMessage" ng-cloak>
Invalid color code
</span>
angular.module('angularstruts').directive('hexadecimalColorValidation', [function(){
return {
restrict: 'A',
require: 'ngModel',
scope: {
},
link: function(scope, elem, attrs, ctrl) {
elem.on('blur', function(event) {
scope.$apply(function() {
var val, hexCodeRegex, validationResult=true;