Skip to content

Instantly share code, notes, and snippets.

KC KazChe

Block or report user

Report or block KazChe

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View gist:9110375
<html ng-app='q.apApp'>
View blog1_second_gist.html
<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>
View blog_gist_3.js
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;
View blog_js_inheritnace.js
var report = {
name: 'xyz',
type: 'monthly'
}
console.dir(report)
Object
name: "xyz"
type: "settlement"
__proto__: Object
View blog_js_inhertinace2.js
Object
name: "xyz"
type: "settlement"
__proto__: Object
__defineGetter__: function __defineGetter__() { [native code] }
__defineSetter__: function __defineSetter__() { [native code] }
__lookupGetter__: function __lookupGetter__() { [native code] }
__lookupSetter__: function __lookupSetter__() { [native code] }
constructor: function Object() { [native code] }
hasOwnProperty: function hasOwnProperty() { [native code] }
View blog_js_inheritance.js
report[toString] = function() {// do something toStringy
}
report.hasOwnProperty(toString)
true
// now when you inspect the report object
Object
function toString() { [native code] }: function () {// do something toStringy
}
name: "xyz"
View blog_post_justdoit.js
var fs = require("fs"),
path = require("path"),
p = "/some-app/webapp/WEB-INF/jsp",
files,
result = {
"name": null,
"type": null,
"location": null
},
allResults = new Array();
View blog_justdout.js
var terminal = require('child_process').spawn('cmd');
terminal.stdout.on('data', function (data) {
console.log('stdout: ' + data);
});
terminal.on('exit', function (code) {
console.log('child process exited with code ' + code);
});
@KazChe
KazChe / main.js
Created Mar 27, 2014
blog_socketio_client_js
View main.js
// This is important, the io.connect has to point where socket server
// is running - simple but took me while to connect the periods/dots/slashes...it's weekend, what am I doing?
var socket = io.connect('http://localhost:8111');
// image related socket
socket.on('user image', function(m){
// $('#imageReceivedMessage').text("> "+m);
$('#imageSentFromServer').attr('src', m);
});
@KazChe
KazChe / server.js
Created Mar 27, 2014
blog_socketio_server_js
View server.js
var http = require('http'),
io = require('socket.io'),
sys = require('sys'),
express = require('express'),
fs = require('fs');
var port = 8111;
var app = express();
app.use(express.errorHandler({showStack: true, dumpExceptions: true}));
You can’t perform that action at this time.