Skip to content

Instantly share code, notes, and snippets.

👨‍💻
Code + Design + Craft

Sabarinathan Masilamani (Nathan) nathan5x

👨‍💻
Code + Design + Craft
Block or report user

Report or block nathan5x

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
@nathan5x
nathan5x / JSUtilSetProp.js
Created Dec 17, 2018
Set a value of property at any deeply nested JavaScript object collection and return the newly created object
View JSUtilSetProp.js
const data = {
foo: {
bar: {
cc: {
str: "Hello I'm deep"
},
dd: "Just a level up",
},
dd: {
cc: "Just another level up"
@nathan5x
nathan5x / JSUtilGetProp.js
Last active Dec 17, 2018
Get deep property values from JavaScript objects by passing key path as an Array
View JSUtilGetProp.js
const data = {
foo: {
bar: {
cc: {
str: "Hello I'm deep"
},
dd: "Just a level up",
},
dd: {
cc: "Just another level up"
@nathan5x
nathan5x / create-ui-js_4.js
Created Apr 12, 2018
Create UI Component in HTML, CSS, and JS like it is in Adobe Flex & ActionScript
View create-ui-js_4.js
$(document).ready(function() {
var myLoginControl = new LoginControl();
myLoginControl.loginInitialize($('#instance1'), "Instance 1");
myLoginControl = new LoginControl();
myLoginControl.loginInitialize($('#instance2'), "Instance 2");
});
@nathan5x
nathan5x / create-ui-js_3.js
Created Apr 12, 2018
Create UI Component in HTML, CSS, and JS like it is in Adobe Flex & ActionScript
View create-ui-js_3.js
var LoginAdapter = {
loginServiceURL : 'api.yoursite.com/login',
loginHTTPMethodType : 'POST',
login : function (instance) {
var loginData = instance.loginData;
/* Client Side Processing for demonstration*/
if(loginData.username === 'user' && loginData.password === 'pwd') {
$('#status').text(instance.name +": Succeeded");
} else {
$('#status').text(instance.name +": Failed");
@nathan5x
nathan5x / create-ui-js_2.js
Created Apr 12, 2018
Create UI Component in HTML, CSS, and JS like it is in Adobe Flex & ActionScript
View create-ui-js_2.js
LoginControl.prototype = {
loginInitialize: function(placeHolder, name) {
var currentInstance = this;
var view = currentInstance.loginUI;
currentInstance.name = name;
view.children('.login-form').submit(function(event) {
if(currentInstance.loginData.username === '' || currentInstance.loginData.password === '') {
alert (currentInstance.name + ': Input fields should not be empty');
} else {
LoginAdapter.login(currentInstance);
@nathan5x
nathan5x / create-ui-js.js
Created Apr 12, 2018
Create UI Component in HTML, CSS, and JS like it is in Adobe Flex & ActionScript
View create-ui-js.js
function function LoginControl() {
this.loginData = { username:'', password:'' };
this.name = '';
this.loginUI = $('<div class="login-ui"> \
<form name="loginForm" class="login-form"> \
<div class="form-fields"> \
<label class="title"> User Login </label> \
<div class="form-field"> \
<input type="text" class="input-text username" name="username" placeholder="User ID"/> \
</div> \
@nathan5x
nathan5x / create-ui-component.html
Last active Apr 12, 2018
Create UI Component in HTML, CSS, and JS like it is in Adobe Flex & ActionScript
View create-ui-component.html
<body>
<!-- Main Container to hold Grid and Navigation Pad -->
<div id="status"> </div>
<!-- To hold instance 1 UI -->
<div id="instance1"> </div> <br/>
<!-- To hold instane 2 UI -->
<div id="instance2"> </div>
</body>
@nathan5x
nathan5x / sort_icon-dojo.js
Created Apr 11, 2018
Adding sort icon to Dojo Data Grid
View sort_icon-dojo.js
function displayDefaultSortIcon(grid, fieldName){
if(grid && grid.layout) {
dojo.forEach(grid.layout.cells, function(cell, idx) {
if(cell.field === fieldName) {
var targetCell = $('#'+cell.id);
if(targetCell) {
targetCell.attr("aria-sort","descending");
var domToAddSortIcon = $(targetCell.find('.dojoxGridSortNode'));
if(domToAddSortIcon) {
domToAddSortIcon.empty();
@nathan5x
nathan5x / txt
Created May 23, 2017
Ionic Internals - Platforms
View txt
Here are the platform names that are tested in Ionic Platform
| Platform Name | Description |
* |-----------------|------------------------------------|
* | android | on a device running Android. |
* | cordova | on a device running Cordova. |
* | core | on a desktop device. |
* | ios | on a device running iOS. |
* | ipad | on an iPad device. |
* | iphone | on an iPhone device. |
You can’t perform that action at this time.