#JavaScript第三次记录整理
作业地址传送门 ##一.数组
上次交流的时候,我们讨论过JS的两个基本类型,Number和String类型,分别表示数和字符串。
但是只有 Number 和 String 类型是不够的。表示更加复杂的类型则需要数组(Array)和对象(Object)。
先讲数组。一个数组类似于一个列表,可以储存多个JS的类型值。
#JavaScript第三次记录整理
作业地址传送门 ##一.数组
上次交流的时候,我们讨论过JS的两个基本类型,Number和String类型,分别表示数和字符串。
但是只有 Number 和 String 类型是不够的。表示更加复杂的类型则需要数组(Array)和对象(Object)。
先讲数组。一个数组类似于一个列表,可以储存多个JS的类型值。
#JavaScript第五次记录整理
###关于上次函数的复习
对象的属性也可以是一个函数,比如 var a = {b: 9, c: function () {} };
这里 a.c
就是一个函数,对象的函数称为方法。其实没什么特殊的,只不过是一个属性而已.
不过呢,JS语言规定,在以 a.c()
这种形式调用函数时,在函数c
调用过程中设置 this
变量为 a
.
// Use Gists to store code you would like to remember later on | |
console.log(window); // log the "window" object to the console |
# This script can be used to raise a graylog2/gelf message | |
# gzip it and send it to a graylog server using netcat (nc) | |
hostname='gelftester' | |
short_message='test message short version' | |
full_message='longer test message. dont\n worry be happy' | |
level=1 | |
facility='gelftester' | |
# gnu date | |
date=$(date +'%s.%N') |
shell判断文件,目录是否存在或者具有权限 | |
#!/bin/sh | |
Path="/var/log/httpd/" | |
File="/var/log/httpd/access.log" | |
#这里的-x 参数判断$Path是否存在并且是否具有可执行权限 | |
if [ ! -x "$Path"]; then | |
mkdir "$Path" | |
fi |
#!/usr/bin/env python | |
# -*- coding: UTF-8 -*- | |
import sched, time | |
from threading import Thread, Timer | |
import subprocess | |
s = sched.scheduler(time.time, time.sleep) | |
class Job(Thread): |
#!/bin/sh | |
# Converts a mysqldump file into a Sqlite 3 compatible file. It also extracts the MySQL `KEY xxxxx` from the | |
# CREATE block and create them in separate commands _after_ all the INSERTs. | |
# Awk is choosen because it's fast and portable. You can use gawk, original awk or even the lightning fast mawk. | |
# The mysqldump file is traversed only once. | |
# Usage: $ ./mysql2sqlite mysqldump-opts db-name | sqlite3 database.sqlite | |
# Example: $ ./mysql2sqlite --no-data -u root -pMySecretPassWord myDbase | sqlite3 database.sqlite |
#!/usr/bin/env python | |
#-*- coding: utf-8 -*- | |
''' | |
Copyleft (c) 2016 breakwa11 | |
https://github.com/breakwa11/shadowsocks-rss | |
''' | |
import socket | |
import traceback |