Skip to content

Instantly share code, notes, and snippets.

@nodlAndHodl
nodlAndHodl / class.js
Created June 8, 2018 18:49
ES6 Classes
//this is the old way of creating a class using protypal inheritance.
//As you see this is somewhat cumbersome and difficult to follow
var Employee = function(){
};
//Assign the do work method to the Employee object.
Employee.prototype ={
doWork: function(){
return "complete";
}
@nodlAndHodl
nodlAndHodl / string-literals.js
Created June 1, 2018 21:39
Template Literals in ES6
//instead of doing string concatenation like so:
let name = "Nick";
let last = "Dude";
let full = "My name is " + name + " " + last;
// we can do the following in ES6 for string literals using template
let redo = `My name is {name} {last}!`;
@nodlAndHodl
nodlAndHodl / spread.js
Created June 1, 2018 21:34
Spread Operator in ES6
let doWork = function(x, y, z){
return x + y + z;
}
//using the ... syntax on an array we are able to pass in the params as follows:
nums = [1, 2, 3]
let result = doWork(...nums)
//which is the equivelent as
@nodlAndHodl
nodlAndHodl / task.js
Last active March 30, 2018 19:47
Javascript Create New Object
//using the new keyword for creating javascript object. Using a constructor function.
//Links to an object prototype
//Demo on creation of new constructor
let Task = function(name){
this.name = name;
this.completed = false;
}
//using binding of functions to this.prototype
//using this, reduces the creation of new save,
//or complete function everytime a new Task is created.
@nodlAndHodl
nodlAndHodl / ArcobjectsTable.cs
Created March 14, 2018 17:13
Using Arcobjects For Table Updates in SDE environments
public static void PopulateFeatureToMetadata(ProductMetadataTables metaTable, IFeatureWorkspace tempFWS, IFeatureWorkspace extractWS, string pidTableName)
{
using (ComReleaser comReleaser = new ComReleaser())
{
ITable srcFeatureMetadataTable = extractWS.OpenTable(metaTable.Owner + "." + metaTable.Source_Meta_table);
ITable pidTable = extractWS.OpenTable(pidTableName);
ITable outFeatMetaDataTable = tempFWS.OpenTable(metaTable.Source_Meta_table);
//using these to get the field index for the cursor to search on.
int tempIndePermId = outFeatMetaDataTable.FindField(metaTable.Meta_field);