HereissomeimportantcommandsorcodesnippetsondifferenttopicsthatIamlearninginmydevelopinglife.
TableofContentsMyDailyLearnTableofContentsGitJavaScriptVanillaJavaScriptVueNodeReactAngularGulpUnitTestingDockerGitConfiguregitConfigfilelocationsConfigureuser'sname&emailVariousimportantconfigcommandsBranchingCreatenewbranchDeletebranchQuickswitchbacktopreviousbranch/commit-sha/referencesetc.BranchlistingRenameabranchTracknewbranchCheckoutbranch/commit-sha/references/etc.(goforward/backward)Add,Commit,Amend,Pull,Push,Merge&DeleteCheckoutforward/backwardCherryPickStashingLoggingShow-moreloggingRecoveryorResetResetusingreflogSquashRebaseChangetheauthorofanearliercommitChangethecommitmessageofanearliercommitReorderingcommitsusingrebaseRebaseoptionsWorkingwithremotesConflictse.g.Mergingreleasebranchintomasterandwehave3foldersfoo/,bar/,js/.Nowwanttoresolveconflictssuchasfoo/,bar/shouldlikemasterandjs/shouldlikereleasebranch.GitSubmodulesSomeimportantoperationsCleanupgarbageinremoterepositoryPruneemptycommitsCreateanewWorkTreeandworkparalleyinthesamerepo(diffeentbranch)Addasigned-off-byfieldinacommitHowtotellgittoignorelocalchanges(alreadytrackedbygit)?GenerateaGitHash(SHA1)forspecificcontentsTagandReleasesFancyCommandsConceptsTrackedvsUntrackfileGitHubvsGitCommitObjectThreeareaswherecodelivesThreetypesofgitReferencesDifferenttypesofHEADTheSevenRulesofaGreatGitCommitMessageDifferencebetweenHEAD~andHEAD^JavaScriptVanillaJavaScriptHoisting
ExplainHoistinginJavaScriptWhyHoistingImportant?First,memoryissetasideforallnecessaryvariablesanddeclaredfunctionsFunctionExpressionsareneverhoisted!TheyaretreatedasassignmentsCheckifreturnstatementisatthetopAnalyzingHoistingLoadOrderIAnalyzingloadorderIIAnalyzingLoadOrderIIIThevariablesdeclaredwithletorconstarehoistedbutstayuninitialisedClosure
ClosuresandReferencesClosuresHelpinFunctionConstructionZonesLoopswithClosure:AcautionaryTalePrototypesandInheritance
Prototypes!WhatisConstructorcall?Whatis[[Prototype]]andwheredoesitcomefrom?Howdoes[[Prototype]]affectthebehaviorofanobject?Whatisthe3differentwaystofindwhereanobject[[Prototype]]linkedto?Discuss:__proto__,[[Prototype]],prototypeTwomechanismalwaysexistsinJavaScirpt--LexicalScopes&PrototypeChainObjectOrientedinJavaScriptExplanationofPrototypeWhenaninheritedfunctionisexecuted,thevalueofthispointstotheinheritingobject,nottotheprototypeobjectwherethefunctionisanownpropertyNewobjectusingObject.create()(ES5)NewobjectusingclasssyntacticalsugarSimilarinObjectpatternUsehasOwnProperty()toknowifthepropertyexistsasit'sownpropertyPrototypeshadowingAvoidShadowingObjectLinkedOLOO(ObjectLinkedtoOtherObject):delegatedobjectsConverttheabovecodestoOLOOClassinES6DifferentwaystocreateobjectsandtheresultingprototypechainDigintosomeexamplesfromMDNNotesWehavetocallsuperfirstinconstructorCoercion
ExplainCoercioninJavaScriptwithexamplesClass
PublicclassfieldsPrivateclassfieldsPublicandstaticpropertiesJavaScriptthiskeyword
Howdoesthiskeywordchangeindifferentcontext?1.thisinGlobalContext2.thisinObjectConstructor3.thisinanObjectMethod4.thisinaSimplefunction5.thisinaArrowfunction6.thisinEventlistenerDefaultRulesHardBindingofthisPriorityofthisbinding(top->bottom:hight->low)ImmediatelyInvokedFunctionExpression(IIFE)
EventLoop
UnderestingAsynchronousJavaScript---EventLoopExample1Example2Example3:CallbackHellJavaScriptReactivityUsingObject.defineProperty()
JSQuestionsandAnswers
Whatisasynchronousprogrammingandwhyisitimportant?ExplainEventDelegationDescribeEventBubblingWhatarebenefitsofnamedfunctionoveraanonymousfunctionDifferencebetweentargetvscurrentTargetWhatisFactoryFunction?Difference:null,undefinedandundeclared?WhatdoesJavaScriptgetandgetterkeyworddo?DefineagetteronnewobjectsinobjectinitializersDefiningagetteronexistingobjectsusingdefinePropertyUsingacomputedpropertyGetvsdefineProperty()WhatisthetwoconditionsofbeingModule?HowtogetUniquevaluesofanArray?HowtoremoveallfalsyvaluesfromanArray?HowtocreateanEmptyObject?Howtorequirefunctionparametersbyforce?HowtogetQueryStringParameters?WhatisDebouncinginJavaScript?Howtodeterminewhatshouldbethethiskeywordvalue?ConvertastringtospinalstringWhattypeofScopingRule(s)doesJavaScripthave?Whatare3differentwayswecancreateanewScopedvariable?Whatarethefourthingsthenewkeywordactuallydoeswhenweputinfrontofafunctioncall?Whatisthedifferentbetweenundeclaredandundefined?WhatistheonlyvalueinJSthatisnotequaltoitself!?Whatdoeshappenwhenwedeclareavariablewithvarandlet?Compare:null,undefiend,NaNImplementanEventEmitterthatsupportsstandardoperationsHowtoWriteOptimizedJavaScript?VueWhatisVue.js?InstallingKnownOptionsforVueInstanceKeySentencesForLoopBindAttributeandClassNameDynamicComponentsPreventDestroyingcomponentswhenrenderingDynamiccomponentsLazyLoadingOff-screenComponentsDisableRe-renderingwithv-onceOutputRawHTMLwithv-htmlDirectivesGetEventDatafromtheEventPassOwnArgumentswithEventObjectModifyingandEventwithModifiersListeningtoKeyboardEventsWriteJavaScriptCodeintoTemplateUsingTowWayBindingv-model="variable"TwoWayBindingfromChildtoParentReactingtoChangingwithComputedPropertiesDynamicStylingwithCSSClassesSettingStylesDynamicallywithoutCSSClassesStylingElementswithanArraySyntaxConditioningRenderingwithv-if/v-elseAlternativeofv-ifusing<template>Usev-showifwedon'twanttodetachelementfromDOMRenderingListswithv-forUseofv-forwith<template>LoopingthroughObjectsLoopingthroughaListsofNumbersKeepingTrackofElementsWhenusingv-forAccessTemplatefromVueModulebySettingaRefMountingaTemplateVueJSinstanceLifeCyclePassHTMLContentfromParenttoChildUsing<slot>HowDirectivesWorksHTML5HistoryModeDifferenceBetweenv-modelandv-bindVuexServiceWorkerCachingConfig-ProgressiveWebAppTogglingSimilarElementsVueObservable-AlternatetoVuexVueRouterhas3TypesofGuardsVueFiltersDefineLocalFilterDefineaGlobalFilterChainedFilterFilterwithArgumentsMixinVueCheatSheetsVuexCheatSheetsShortcutsInitialRenderVirtualDOMRuntime+Compilervs.Runtime-onlyCompileTemplatesinClientManuallyReactivityinDepthReactivityinsideComputedPropertiesParent-childCommunicationReactWhatisReactInstallingUseDefaultPropsUsePropTypestoDefinethePropsWeExpectUnderstandingReactsetStateUpdateaStatePropertyPassingaFunctiontosetState()AccessPreviousStateusingUpdaterStatelessFunctionComponent,StatelessComponentandStatefulComponentCompound,UncontrolledandControlledComponentsCompoundComponentUncontrolledComponentControlledComponentReactFragmentReactAppLife-cycleWalkthroughUnderstandContextAPIReferencingContextinStatelessFunctionalComponentsHigherOrderComponentAlternativeStateInitializationReduxvsContextAPILifeCycleHooksorMethodsResandtheDOMWhentoUseRefsCreatingRefsAccessingRefsUseCallbackonImageLoadwithRefReactRouteFamiliarwithVariousReactRouterLibrariesHowtoNotNavigationwithReactRouterThree(3)TypesofRouterReactPortalsUsageofPortalsReactQuestionsandAnswersHowtoPreventfromre-rendering?WhentoUseComponentInsteadofPureComponent?Whatistherenderprops?ReactUnitTestsvsIntegrationTestsforComponents?MigrationfromClasstoFunctionComponentNodeAngularGulpUnitTestingDockerDockerInstall(latestoraspecificversion)RundockerasdaemonRemoveallcontainersRemoveallimagesRunanimageprintlogofacontainerExecacontainerRunimagewithbindingport
评论