markdown Edx备忘录

Edx.md
# Learning Strategies
- I usually study in a place where I can concentrate on my course work.	
- I often find myself questioning things I hear or read in course that I am taking to decide if I find them convincing.	
- I make good use of my study time.	
- When a theory, interpretation, or conclusion is presented in a course, I try to decide if there is good supporting evidence.	
- When I study, I treat the course material as a starting point and try to develop my own ideas about it.	
- I find it hard to stick to a study schedule.	
- I have a regular place set aside for studying.	
- I try to play around with ideas of my own related to what I am learning.	
- I will make sure that I keep up with the weekly videos and assignments for this course.	
- Whenever I read or hear an assertion or conclusion in a course, I think about possible alternatives.	
- I often find that I don’t spend very much time on online course that I've taken because of other activities.	
- I rarely find time to review my notes before an exam.

Motivation
- In a course like this, I prefer course material that really challenges me so I can learn new things	
- I think I will be able to use what I will learn in this course in other courses	
- I believe I will receive an excellent grade in this course	
- I’m certain I can understand the most difficult material presented in this course.	
- It is important for me to learn the material in this course	
- I’m confident I can learn the basic concepts taught in this course	
- I’m confident I can understand the most complex materials that will be presented by the instructor in this course	
- In a course like this, I prefer course material that arouses my curiosity, even if it is difficult to learn	
- I am very interested in the content area of this course.	
- I’m confident I can do an excellent job on the assignments and tests in this course.	
- I expect to do well in this class.	
- The most satisfying thing for me in this course will be trying to understand the content as thoroughly as possible	
- I think the course material in this course will be useful for me to learn	
- When I have the opportunity in this kind of courses, I try to do all the exercises and course assignments that I can learn from even if they don’t guarantee a good grade.	
- I like the subject matter of this course.	
- Understanding the subject matter of this course is very important to me.	
- I’m certain I can master the skills that will be taught in this course	
- Considering the difficulty of this course, the teacher, and my skills, I think I will do well in this course	
- In a course like this, I prefer course material that really challenges me so I can learn new things	
- I think I will be able to use what I will learn in this course in other courses	
- I believe I will receive an excellent grade in this course	
- I’m certain I can understand the most difficult material presented in this course.	
- It is important for me to learn the material in this course	
- I’m confident I can learn the basic concepts taught in this course	
- I’m confident I can understand the most complex materials that will be presented by the instructor in this course	
- In a course like this, I prefer course material that arouses my curiosity, even if it is difficult to learn	
- I am very interested in the content area of this course.	
- I’m confident I can do an excellent job on the assignments and tests in this course.	
- I expect to do well in this class.	
- The most satisfying thing for me in this course will be trying to understand the content as thoroughly as possible	
- I think the course material in this course will be useful for me to learn	
- When I have the opportunity in this kind of courses, I try to do all the exercises and course assignments that I can learn from even if they don’t guarantee a good grade.	
- I like the subject matter of this course.	
- Understanding the subject matter of this course is very important to me.	
- I’m certain I can master the skills that will be taught in this course	
- Considering the difficulty of this course, the teacher, and my skills, I think I will do well in this course


brief introduction about myself.

markdown 潜入Javascript

DivingIntoJavascript.md
# CS50 
by => Jordan Hayashi

## Lecture 0 : Diving Into Javascript

Interpretor

### Syntax

```js
var fisrtname = "art";
var lastname = "dvp";
var arr = ['student' , 23,true , function(){
  console.log('hi')
}];

//hi 
for(var i = 0 ; i < arr.length; i++){
  console.log(arr[i]);
}
```

### Types

- Dynamic typing
- Primitive tpyes(no methods)
  - undefined
 - null
 - boolean
 - number
 - string
 - (symbol)

### Typecasting ? Coercion
- Explicit vs. Implicit coercion
 - var x = 42;
 - var explicit = String(x); // explicit === "42"
 - var implicit = x + "" ; // implicit === "42"

- == vs. ===
 - == coerces the type
 - === requires equivalent types

Coercion, cont.
- Which values are falsy?
 - undefind
 - null
 - false
 -  +0 , -0 , NaN


- Which values are truthy?
 - {}
 - []
 - Everthing esle
 
 ### Objects, Arrays ,Functions,Objects
 - ^ did i put Object twice?
 - Nope,I put it 4 time
 
 - Everything else is an object
 - Prototypical Inheritance
 
 ```js
 var o = new Object();
 o.firstname = "art";
 o.lastname = "dvp";
 o.isStudent = true;
 o.age = 23;
 o.greeting = function() { console.log("Hey"); };
 
 console.log(JSON.stringify(o));
 
 var o2 = {};
 o2['firstname'] = "art";
 var a = 'lastname';
 o2[a] = 'DVP';
 
 var o3  = {
  firstName : "ART",
  lastName : "DvP",
  greet : function(){
    console.log('hi');
  },
  address : {
    street : 'Main st.',
    number : '111'
  }
 };
 ```
 
 ### Prototpical Inheritance
 - Non-primitive types have a few properties/method associated with them
  - Array.prototype.push()
  - String.prototype.toUpperCase()
  
 - Each object stores a reference to its prototype
 - Properties/methods defined most tightly to the instance have priority
 
 ### Prototypical Inheritance
 - Most primitive types have object wrappers
  - String()
  - Number()
  - Boolean()
  - Object()
  - (Symbol())

- JS will automatically "box" (wrap) primitive values so you have access to methods

```js
42.toString() //Error
var x = 42;
x.toString() // "42"
x.__proto__ // [Number : 0]
x instanceof Number // false


var xx = new Number(32);
```

- Why use reference 
- What's the alternative?
- What's the danger?

### Scope
- Variable lifetime
 - Variables live from when they're declared until when their function ends
- Hoisting 
 - Function definitions are hoisted, but not varible initializations
```js
greeting();
doesThisWork();

function doesThisWork(){
	console.log('pls');
}

function greeting(){
	console.log('Hi');
}
```

- But/How why?

The Javascript Engine
- Before executing the code, the engine reads the entire file and will throw a syntax error if one is found
 - Any function definitions will be saved in memory
 - Variable initializations will not be run ,but variable names will be declared
 
 ```js
 console.log(i);
 greeting();
 
 var i = 42;
 
 function greeting(){
 	console.log('Hi');
 }
 
 ```
 
 ```js
 var i 
 ```

### The Global Object
- All variables and functions are actually parameters and methods on the global object
 - Browser global object is the 'window' object
 - Node.js global object is the 'global' object
 
### Execution context
- Equivalent to a 'stack frame' in C
- Wrapper of varibles and functions local to a function's execution
- Collection of execution contexts is known as the execution stack

### Lexical environment
- Determines how variable names are resolved, especially with nested functions 
 - Child functions contain the scope of the parent function,even if the parent has returned
 
 ```js
 var x = 50;
 function test(){
 	var x = 42;
	function printX(){
		console.log(x);
	}
 }
 ```
 # Lecture 1 : Advanced JavaSript

markdown 欢迎来到Cacher

以下是一些可帮助您开始构建代码段库的提示。

cacher_intro.md
# Getting Started with Cacher

<p align="center">
<img src="http://www.cacher.io/assets/intro-snippet-splash-a90755aca4db13aac1e5140e8d7c2a7c01d9b69a640e51b55093421dff432039.png" width="480" />
</p>


## Use snippets to quickly recall commands

Snippets are the most useful when you want to re-use a shell command or a specific code pattern. Here are a few we have in our library:
- "How to delete a git tag"
- "Nginx configuration for staging server"
- "Crash handler AWS Lambda function"

## Use snippets for customer service

Engineers are often second-line customer agents. Use Cacher to store snippets for performing common support tasks.

## Labels are your friend

Labels are a great way to organize your snippets. A good practice is to have one for every major product feature. We've created the first label for you - **Documentation**.

## Create or join a team to share knowledge

Teams allow you and your colleagues to build a shared knowledge base. Use [Markdown](https://github.com/adam-p/markdown-here/wiki/Markdown-Cheatsheet) to write beautifully formatted documentation. (This snippet itself is a Markdown file.)

## Use snippets for onboarding new team members

Let's face it. Having the new engineer decipher a 500 thousand-line codebase might not be an efficient use of her time. Use snippets as examples to help new members get up to speed fast.


markdown 欢迎来到Cacher

以下是一些可帮助您开始构建代码段库的提示。

cacher_intro.md
# Getting Started with Cacher

<p align="center">
<img src="http://www.cacher.io/assets/intro-snippet-splash-a90755aca4db13aac1e5140e8d7c2a7c01d9b69a640e51b55093421dff432039.png" width="480" />
</p>


## Use snippets to quickly recall commands

Snippets are the most useful when you want to re-use a shell command or a specific code pattern. Here are a few we have in our library:
- "How to delete a git tag"
- "Nginx configuration for staging server"
- "Crash handler AWS Lambda function"

## Use snippets for customer service

Engineers are often second-line customer agents. Use Cacher to store snippets for performing common support tasks.

## Labels are your friend

Labels are a great way to organize your snippets. A good practice is to have one for every major product feature. We've created the first label for you - **Documentation**.

## Create or join a team to share knowledge

Teams allow you and your colleagues to build a shared knowledge base. Use [Markdown](https://github.com/adam-p/markdown-here/wiki/Markdown-Cheatsheet) to write beautifully formatted documentation. (This snippet itself is a Markdown file.)

## Use snippets for onboarding new team members

Let's face it. Having the new engineer decipher a 500 thousand-line codebase might not be an efficient use of her time. Use snippets as examples to help new members get up to speed fast.


markdown 欢迎来到Cacher

以下是一些可帮助您开始构建代码段库的提示。

cacher_intro.md
# Getting Started with Cacher

<p align="center">
<img src="http://www.cacher.io/assets/intro-snippet-splash-a90755aca4db13aac1e5140e8d7c2a7c01d9b69a640e51b55093421dff432039.png" width="480" />
</p>


## Use snippets to quickly recall commands

Snippets are the most useful when you want to re-use a shell command or a specific code pattern. Here are a few we have in our library:
- "How to delete a git tag"
- "Nginx configuration for staging server"
- "Crash handler AWS Lambda function"

## Use snippets for customer service

Engineers are often second-line customer agents. Use Cacher to store snippets for performing common support tasks.

## Labels are your friend

Labels are a great way to organize your snippets. A good practice is to have one for every major product feature. We've created the first label for you - **Documentation**.

## Create or join a team to share knowledge

Teams allow you and your colleagues to build a shared knowledge base. Use [Markdown](https://github.com/adam-p/markdown-here/wiki/Markdown-Cheatsheet) to write beautifully formatted documentation. (This snippet itself is a Markdown file.)

## Use snippets for onboarding new team members

Let's face it. Having the new engineer decipher a 500 thousand-line codebase might not be an efficient use of her time. Use snippets as examples to help new members get up to speed fast.


markdown 重写模块apache di .htaccess untuk melakukan redirect non https ke https dan non www ke www

重写模块apache di .htaccess untuk melakukan redirect non https ke https dan non www ke www

rewrite-module-apache-htaccess-cpanel.md
```
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond %{HTTPS} !=on
RewriteRule ^/?(.*) https://%{SERVER_NAME}/$1 [R,L]
RewriteCond %{HTTP_HOST} ^example.com [NC]
RewriteRule ^(.*)$ http://www.example.com/$1 [L,R=301,NC]
</IfModule>
```

markdown 复制Minecraft的步骤保存到PC

复制Minecraft的步骤保存到PC

copy-mc-saves.md
Steps for copying Minecraft saves to a PC
====

(*There's more of this Gist than will fit in the preview. Click on it to see the whole thing*)

First, open, play and then quit Minecraft at least once; to make a `.minecraft` appdata folder)

1. Open Windows Explorer (press `Win+R`, then type `explorer`)
1. Go to the `%appdata%` directory.  There should be a folder called `.minecraft` listed
1. Open the `.minecraft` folder. There should be a `saves` folder in it.
1. Open a second Windows Explorer window (pressing `Ctrl+N` *might* work, or type `Win+R` and `explorer` again)
1. Go to the USB drive
1. Copy your *World* folder into the `saves` folder on the first window.  e.g. if your *World* is called `Frobnitz` then copy that folder.

Now you can start Minecraft.  If you go to *Single Player* then the "Frobnitz" world should be available to play

But there is no `saves` in the `.minecraft` folder?!
----

Someone's hand-crafted the Minecraft profile to put them elsewhere. Perhaps a drive other than `C:` to avoid filling it with everyone's Minecraft worlds!

You'll need to open up the `launcher_profiles.json` file (with WordPad) and look for the `gameDir`:

```
 "gameDir": "F:\\minecraft\\saves",
```

Whatever value that is (`F:\minecraft\saves` in this example -- the double `\\` is because the `\` has special meaning in Minecraft's programming language, so it has to be "escaped") is where you need to copy your *World* folder to.

Copying back
----

Any changes you make in the game will *not* go back onto the USB.  You'll have to copy back after, if you want to keep them:

1. Go to the `%appdata%\.minecraft\saves` directory (or wherever the *gameDir* is on the PC) in one `explorer` window (open a new one if you didn't keep the one above open)
1. Go to the USB drive in another `explorer` window (ditto about the one from before...)
1. Copy your *World* folder back to the USB

markdown 暂时更改便携式设置的%APPDATA%(Windows:例如Minecraft)

暂时更改便携式设置的%APPDATA%(Windows:例如Minecraft)

minecraft.cmd
set APPDATA=%CD%\data          
bin\minecraft.exe
appdata.md
Need to take `%APPDATA%` directory data to another PC?  For example Minecraft game saves to take in to a school for projects, or to a friend's house.  The tricky part is:  `%APPDATA%` has a different location depending on the version of Windows. Yay Microsoft, thanks once again.

The good news is that many Windows programs do use the environment variable to locate this folder, so you can just override it and launch your game or whatever from a `.cmd` / `.bat` file.

In the case of Minecraft on a USB:

  1. Make a folder structure on the USB drive for it (assume `E:` is the USB): 
     * `E:\Minecraft`
     * `E:\Minecraft\bin`
     * `E:\Minecraft\data` 
  1. Copy your Minecraft binaries into the `\bin` folder and your `%APPDATA%\.minecraft` into `\data`
  1. Make a batch file to launch the game (below) and save it to `E:\Minecraft\minecraft.bat`
  1. Lanch the batch file to play the game
  
 This will run the game from the USB, which could be slow.  Also it'll still require Java to be installed. 

markdown 欢迎来到Cacher

以下是一些可帮助您开始构建代码段库的提示。

cacher_intro.md
# Getting Started with Cacher

<p align="center">
<img src="http://www.cacher.io/assets/intro-snippet-splash-a90755aca4db13aac1e5140e8d7c2a7c01d9b69a640e51b55093421dff432039.png" width="480" />
</p>


## Use snippets to quickly recall commands

Snippets are the most useful when you want to re-use a shell command or a specific code pattern. Here are a few we have in our library:
- "How to delete a git tag"
- "Nginx configuration for staging server"
- "Crash handler AWS Lambda function"

## Use snippets for customer service

Engineers are often second-line customer agents. Use Cacher to store snippets for performing common support tasks.

## Labels are your friend

Labels are a great way to organize your snippets. A good practice is to have one for every major product feature. We've created the first label for you - **Documentation**.

## Create or join a team to share knowledge

Teams allow you and your colleagues to build a shared knowledge base. Use [Markdown](https://github.com/adam-p/markdown-here/wiki/Markdown-Cheatsheet) to write beautifully formatted documentation. (This snippet itself is a Markdown file.)

## Use snippets for onboarding new team members

Let's face it. Having the new engineer decipher a 500 thousand-line codebase might not be an efficient use of her time. Use snippets as examples to help new members get up to speed fast.


markdown Merubah域名(URL)instalasi cms berbasis wordpress di共享主机杨menggunakan控制面板cPanel

Merubah域名(URL)instalasi cms berbasis wordpress di共享主机杨menggunakan控制面板cPanel

merubah-url-domain-wordpress-cpanel.md
# Langkah (DRAFT)

> WIP

- Arahkan domain baru (cek whois) ke server hosting yang sama
- Siapkan lokasi di cpanel via addon domain pastikan path di luar `public_html`
- Copy file dari instalasi wordpress yang lama ke lokasi yang baru melalui file manager cpanel , `Select All > Copy to`
- Siapkan Database, User database dan Password untuk MySQL, username tidak perlu berbeda dengan yang lama, cukup ditambahkan privilegesnya ke database yang baru
- Backup database atau lakukan dump via phpMyAdmin di cpanel, pilih custom dan ubah kompresi menjadi Zip agar tidak terlalu besar ukuran file sql yang nanti harus didownload
- Ekstrak file zip hasil dump mySQL dan buka dengan menggunakan text editor atau code editor yang memiliki fasilitas search & replace yang baik
- Setelah dibuka di code editor search nama domain yang lama misalnya `domainsaya.com` dan replace all dengan `domainbaru.com` , save modifikasi tersebut, zip kembali dengan format `nama.sql.zip`
- Import file zip mySQL yang sudah dimodifikasi menggunakan phpMyAdmin di cpanel di database yang baru
- Lakukan perubahan URL Wordpress dan credensial database melalui `wp-config.php`, kemudian ubah options wordpress di `WP Admin > Setting > General` atau melalui `functions.php` di folder themes yang kita gunakan
- `wp-config.php`

```php
<?php
	
	define('WP_HOME','http://example.com');
	define('WP_SITEURL','http://example.com');
```
- `functions.php`, diatas setelah buka tag <?php

```php
<?php
	update_option( 'siteurl', 'http://example.com' );
	update_option( 'home', 'http://example.com' );
```
- Ubah internal linking di file template kita, yang sebelumnya adalah link link di database untuk perubahan di template silahkan lakukan search & replace terhadap folder template kita (download terlebih dahulu)
- Pastikan domain sudah merujuk ke server yang sama dengan perintah dig dan sesuaikan isi dari .htaccess di folder domain yang baru


# Perubahan Domain (URL) Wordpress di Shared Hosting yang menggunakan Control Panel cPanel

Karena satu dan lain hal perubahan terhadap alamat pengenal website kita atau domain harus diubah menggunakan domain lain, untuk keperluan itu kita harus melakukan perubahan secara menyeluruh tidak hanya terhadap option Wordpress terkait, namun juga terhadap semua konten didalamnya seperti interal link atau `src` image yang merujuk ke format URL.

Secara garis besar berikut adalah tahapan yang dilakukan untuk secara sempurna melakukan perubahan URL dengan beberapa asumsi yang juga disebutkan;

- Dengan asumsi tidak ada perpindahan server (hosting dengan akun cpanel yang sama) maka siapkan terlebih dahulu domain yang baru yaitu dengan menunjuk Name Server domain ke NS yang sama dengan domain lama. Otomatis di dalam akun cpanel kita harus dibuatkan `Addon Domain` 
- 


### URL di Wordpress

Di dalam instalasi wordpress ada dua URL yang harus kita definisikan, yang pertama adalah URL atau domain utama yang yang kedua adalah URL tempat kita melakukan instalasi wordpress, contohnya adalah sebagai berikut;

- WordPress Adress URL: `http://domainsaya.com/blog`
- Site Address URL: `http://domainsaya.com`

Perlu diperhatikan bahwa protocol harus disertakan dalam format URL yaitu `http://` atau `https://`, keduanya berbeda dan harus disetup sesuai dengan instalasi yang kita inginkan. Juga perlu diperhatikan bahwa di bagian belakang URL tersebut tidak diakhiri dengan `/` .