// No Comment T-Shirt For Sale

no-comment

So I decided to get into the tshirt business. So I’m going to start designing cool and quirky geeky. Tshirts for devs and nerds. Sometime it has a bit of deadpool humor. If you like my tshirt designs please give me shout out and buy. Thanks All.

Learn More

Sincerely,

Jason Chan

Graphic Artist – Coder – Music Producer – Youtuber – Producer

Super Mario Odyssey (Nintendo Switch) Review

So far I like the game a lot. It’s really fun. It’s mixture of 3d and side strollers. It’s basically mario 64 on steroids. It’s pretty fun and I highly recommend it. The controls are fairly simple and the levels are fairly simple. My only caveat is that the controls are okay. The only thing I don’t like is the camera. It could be a bit tricky to figure out, but youtube has the entire 6 hour walk-through you can watch on how to beat certain levels.

Is it recommended buy? Yes, because it’s fun entertaining. Plus I really like how the levels play. Plus I’m huge fan of mario games. This is probably my first mario 3D game I played. I prefer the jump and coin grabbing side strollers like mega man.

I have yet to beat mega man because mega man is tough game. Mario 3D I’m 3 worlds and it’s one my most favorite games.

The main thing is mario is using a cap and the cap con possess bullets. Plus you can become the monsters to solve various puzzles and levels. The bosses are fair strait forward. Hit them with the cap. Possess the monsters and break things.

We are changing and evolving.

I am changing and evolving. I am growing. I have switched to product reviews and making videos I like. I am no longer going to focus on web dev. I want to approach a wider audience. I just don’t want to have only web developers are my audience. I want a broader spectrum. I will start creating new content and re-evaluating what is valuable for the community and myself.

Please stayed tuned.

Updates on site. We installed SSL. We are more secure. I do not want to keep your data on my website. I do not track and never track my audience.

Listen to my song here

javascript Closure IIFE Immediately Invoked Function

Javascript Closure

This is an example of how to use iffe closure example to avoid collisions with other global variables in your programs. By placing the variable in the function it makes it private and not accessible everywhere else that would create a problem.

// global variable bad because of collisions
// break other programs avoid globals
var names = ['zero', 'one', 'two', 'three', 'four', 'five'];

var digit_name = function (n) {
	return names[n];
}

console.log(digit_name(3)) // 'three'

// SLOW - because we have to create an variable array every time you try invoking it.
// prevents collision of global variables - names
var digit_name = function (n) {
	var names = ['zero', 'one', 'two', 'three', 'four', 'five'];
	return names[n];
}

console.log(digit_name(3)) // 'three'

// closure iife - immediate invoked function 
// it executes the function has access to the variable names in the iffy
var digit_name = (function () {
	var names = ['zero', 'one', 'two', 'three', 'four', 'five'];
	return function (n) {
		return names[n];
	}
})();

console.log(digit_name(3)) // 'three'

 

The third way to do this is the best. To avoid collisions.

Power Constructors

  1. Make an object
    • Object Lateral
    • new
    • Object.create
    • call another power constructor
  2. Define some some variables and functions
    • These become private members
  3. Augment the object with privileged methods.
  4. Return the object
function myPowerConstructor(x) {
	var that = otherMaker(x);
	var secret = f(x);
	that.priv = function () {
		//secret x that
	};
	return that;
}

 

Functional Inheritance

function gizmo(id) {
	return {
		id: id,
		toString: function () {
			return "gizmo " + this.id;
		}
	};
}

function hoozit(id) {
	var that = gizmo(id);
	that.test = function (testid) {
		return testid === this.id;
	};
	return that;
}

Source:

https://developer.mozilla.org/en-US/docs/Web/JavaScript/Closures
https://en.wikipedia.org/wiki/Immediately-invoked_function_expression

How to Setup Your Own Parse Server

Since you already have heard that parse is closing down. Here are some instruction to set up you own parse. You can read more about the announcement here. You Can set up Parse with heroku or AWS.

The guides are at:

Heroku: https://devcenter.heroku.com/articles/deploying-a-parse-server-to-heroku

AWS: http://mobile.awsblog.com/post/TxCD57GZLM2JR/How-to-set-up-Parse-Server-on-AWS-using-AWS-Elastic-Beanstalk

If you’re not sure which to choose I’d go for Heroku as the process is a fair bit more straightforward.

Happy Coding. Now you have your own backend.

Javascript – How to Create Functions to replace text, factorial, check if it’s even

These are some code snippets on how to create functions to check if a number is even. Do a factorial with a for loop. Do a text replacement with regular expressions.

// isEven f(x)
function isEven(arg) {
	return arg%2 === 0
}
// factorial f(x)
function factorial(num) {
	var result = 1;
	for(var i = 2; i <= num; i++) {
		result = result * i;
	}
	return result;
}
// kebabToSnake() Replace a string "-" with '_'s
function kebabToSnake(str) {
	var newStr = str.replace(/-/g , "_");
	return newStr;
}

Javascript – Simple For Loop Examples

These are some examples of simple for loop challenges and exercises I did for fun.

// Print 'hello' the string vertically
var str = 'hello';
for(var count = 0; count < str.length; count++) {
	console.log(str[i])
}
// print all numbers between -10 and 19

for(var i = -10; i < 20; i++) {
	console.log(i)
}

// print even numbers between 10 and 40

for(var i = 10; i < 40; i++) {
	if(i % 2 === 0){
	console.log(i)
	}
}
// print all odd numbers between 300 and 333
for(var i = 300; i < 333; i++) {
	if(i % 3 === 0){
	console.log(i)
	}
}
// print all numbers divisible by 5 and 3 between 5 and 50
for(var i = 5; i < 50; i++)	{
	if(i % 3 === 0 && i % 5 === 0) {
	console.log(i)
	}
}

Javascript can be dynamically typed – Array Example

This is code example of javascript being dynamically typed with arrays. Arrays can store, anything: strings, objects, functions, strings, and integers. Below is example how to call an object lateral and function. Remember arrays start count at 0.

var arr = [1,
           2,
           3,
           {
           name: 'jason',
             addy: '111 fake st'
           },
           function(name){
           	var greeting = 'hello ';
             console.log(greeting + name);
           },
           'hello'
          ];
arr[4](arr[3].name);

// hello jason

How to Setup Babel es2015 Javascript on Windows 8.1?

First create a folder:
Then CD into that folder through CMD
Then do the follow in command-line

npm init
npm install -g babel-cli
npm install babel-preset-es2015–save-dev

Then create app.js.es6 file

Then use this example code:

class Person {
	constructor(name) {
		this.name = name;
	}
	greet(){
		return "Hello I am ${this.name}";
	}
}

let person = new Person("Tyler");
console.log(person.greet());

babel app.js.es6 –presets2015 | clip

Clip copies the string from commandline. Then you should get the follow code output:

"use strict";

var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();

function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

var Person = (function () {
	function Person(name) {
		_classCallCheck(this, Person);

		this.name = name;
	}

	_createClass(Person, [{
		key: "greet",
		value: function greet() {
			return "Hello I am ${this.name}";
		}
	}]);

	return Person;
})();

var person = new Person("Tyler");
console.log(person.greet());

Now we want to create an index.html file

<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title></title>
</head>
<body>
	<h2>ES2015</h2>

	<script src="app.js"></script>
</body>
</html>

babel app.js.es6 –presets es2015 > 5

Now we are going to create a file called .bablrc this file will shorten the command to compile the babel file

{
	presets: ["es2015"]
}

Next we type in this code to make compiling es2015 javascript faster.

babel app.js.es6 > app.js

babel_CMD_setup

https://github.com/JasonDeving/babel2015windowssetup