Skip to content

Instantly share code, notes, and snippets.

View nathan5x-zz's full-sized avatar
👨‍💻
(Code + Design) => Craft

Sabarinathan Masilamani (Nathan) nathan5x-zz

👨‍💻
(Code + Design) => Craft
View GitHub Profile
@nathan5x-zz
nathan5x-zz / JSUtilSetProp.js
Created December 17, 2018 04:15
Set a value of property at any deeply nested JavaScript object collection and return the newly created object
const data = {
foo: {
bar: {
cc: {
str: "Hello I'm deep"
},
dd: "Just a level up",
},
dd: {
cc: "Just another level up"
@nathan5x-zz
nathan5x-zz / JSUtilGetProp.js
Last active December 17, 2018 04:11
Get deep property values from JavaScript objects by passing key path as an Array
const data = {
foo: {
bar: {
cc: {
str: "Hello I'm deep"
},
dd: "Just a level up",
},
dd: {
cc: "Just another level up"
@nathan5x-zz
nathan5x-zz / create-ui-js_4.js
Created April 12, 2018 06:46
Create UI Component in HTML, CSS, and JS like it is in Adobe Flex & ActionScript
$(document).ready(function() {
var myLoginControl = new LoginControl();
myLoginControl.loginInitialize($('#instance1'), "Instance 1");
myLoginControl = new LoginControl();
myLoginControl.loginInitialize($('#instance2'), "Instance 2");
});
@nathan5x-zz
nathan5x-zz / create-ui-js_3.js
Created April 12, 2018 06:45
Create UI Component in HTML, CSS, and JS like it is in Adobe Flex & ActionScript
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-zz
nathan5x-zz / create-ui-js_2.js
Created April 12, 2018 06:45
Create UI Component in HTML, CSS, and JS like it is in Adobe Flex & ActionScript
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-zz
nathan5x-zz / create-ui-js.js
Created April 12, 2018 06:44
Create UI Component in HTML, CSS, and JS like it is in Adobe Flex & ActionScript
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-zz
nathan5x-zz / create-ui-component.html
Last active April 12, 2018 06:46
Create UI Component in HTML, CSS, and JS like it is in Adobe Flex & ActionScript
<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-zz
nathan5x-zz / sort_icon-dojo.js
Created April 11, 2018 20:14
Adding sort icon to Dojo Data Grid
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-zz
nathan5x-zz / txt
Created May 23, 2017 20:21
Ionic Internals - Platforms
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. |