Skip to content

Instantly share code, notes, and snippets.

View lekhanh1234's full-sized avatar

Khanh Le lekhanh1234

View GitHub Profile

Module

Modules divide the program into clusters code

It will help some people does not work with that code from begining can maintain it

literate programming is a way to program, we can easy to understand the code, but when program becomes bigger and bigger then, it is hard to change that code.

Structure make program costly. On the begginning of a project, the structure shoud be as simplest as possible. And it will be developed step by step

Namespacing

#A Programming Language This gist is based on Chapter10, [EloquentJavascript] http://eloquentjavascript.net/ Building a programming is not hard as we think, as long as it can calculate the basic expression.
We's going to buid a programming language called Egg. ##Parsing The most basic part of a programming language is syntax, or notation. So, parsing have to read a text and convert them to the data structure. If the text is not valid form, parsing will show the error.
Everything in Egg is an expression. An Expression can be a variable, a string, a number, or an application!
DataStructure is presented in a bracket. It has some kinds of type:

{type: "value", value: [string or number]};

Browser

HTML Construction

<!doctype html>
<html>
 

#Document Object Model

Document Structure

HTML Structure

<!doctype html>
<html>
  <head>
    <title>Home page</title>

Handling Events

Event Handlers

addEventListener: dom.addEventListener("[event_names]", function(){});

  • click
  • mouseover
  • mouseout
  • keydown
  • scroll

Javascript

Convert from charCode to char

String.fromCharCode(49);
String.fromCharCode(event.charCode);

HTTP

HTTP is the way data is requested and provided in WWW

The Protocol

When access to a URL, the browser will try to connect to the serve of this Website with TCP connection on port 80

After that, if the connection is success, the browser will send more detail. For instance, when we load (http://eloquentjavascript.net/17_http.html), browser will send something like this:

GET /17_http.html HTTP/1.1
Host: eloquentjavascript.net
Connection: keep-alive

Asynchronous and Synchronous

An example of Asynchronous:

setTimeout(function(){
    alert('1');
}, 0);
 
alert('2');

setTimeout is a Asyn function.

Exercise

eval code

<textarea id="code"></textarea>
<button id="button" onclick = run() >Run</button>
<pre id="output"></pre>

<script>
  function run(){

In Unix-like operating systems, '''chmod''' is the command and system call which may change the access permissions to file system objects (files and directories). It may also alter special mode flags. The request is filtered by the umask. The name is an abbreviation of change mode.[1]

History

A chmod command first appeared in AT&T Unix version 1.

As systems grew in number and types of users, access control lists [2] were added to many file systems in addition to these most basic modes to increase flexibility.

Command syntax