This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Person { | |
// String and int variables don't allow `null` | |
// They wanna be initialized | |
// `late` says to compiler to not worry as these vars will be init later | |
late String name; | |
late int age; | |
// constructor with named parameters, with default values | |
Person({String inputName = '', int age = 30}) { | |
name = inputName; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Strategy design pattern | |
interface QuackBehavior { | |
quack(): void; | |
} | |
class Quack implements QuackBehavior { | |
quack() { | |
console.log('quack'); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Xcode | |
!**/*.xcodeproj | |
!**/*.pbxproj | |
!**/*.xcworkspacedata | |
!**/*.xcsettings | |
!**/*.xcscheme | |
*.pbxuser | |
!default.pbxuser | |
*.mode1v3 | |
!default.mode1v3 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
console.clear(); | |
/////////////////////// | |
// Destructure | |
// | |
console.log('///////////////////////\n// Destructure\n///////////////////////'); | |
{ | |
let doWork = ()=> { | |
return { | |
firstName: 'Bernardo', | |
lastName: 'Bechtold', |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var openingSymbols = ['{', '[', '('], | |
closingSymbols = ['}', ']', ')'], | |
counter = 0; | |
function scopeValidator(char) { | |
if (openingSymbols.indexOf(char) != -1) counter++; | |
else if (closingSymbols.indexOf(char) != -1) counter--; | |
} | |
function scopeParser(text) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function Stack() { | |
this._size = 0; | |
this._storage = {}; | |
} | |
Stack.prototype.push = function(data) { | |
var size = ++this._size; //returns i++ | |
this._storage[size] = data; | |
return size; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function isFieldEmpty($field) { | |
return isset($field) && trim($field) == ''; | |
} | |
$data = '0'; | |
echo isFieldEmpty($data); | |
?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var people = [ | |
{'name': 'Mary', 'height': 160}, | |
{'name': 'Isla', 'height': 80}, | |
{'name': 'Sam'} | |
]; | |
var peopleWithHeight = people.filter(function(person) { | |
return person.hasOwnProperty('height'); | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require('shelljs/global'); | |
var moduleName = "moduleName", | |
mainPath = "app/modules/", | |
visibility = "public", | |
full_path = mainPath + visibility + "/" + moduleName + "/"; | |
console.log("------ Creating module " + moduleName + " as " + visibility + " --------"); | |
console.log("-> full path: " + full_path); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function() { | |
var configModule = function configModule( | |
$stateProvider, | |
$urlRouterProvider) | |
{ | |
$stateProvider | |
.state('public.%', { | |
url: "/%", | |
templateUrl: 'modules/public/%/templates/%.view.html', |
NewerOlder