- 浏览: 52012 次
文章列表
自动加载crontab的运行env,并在bash中加载crontab的环境,对script进行测试
http://stackoverflow.com/questions/2135478/how-to-simulate-the-environment-cron-executes-a-script-with
Add this to your cron:
30 08 * * * env > ~/cronenv
After it runs, do this:
env - `cat ~/cronenv` /bin/sh
在cron中加载rvm环境
http://rvm.io/i ...
[CSS] 学习笔记float
- 博客分类:
- CSS
float 属性定义元素在哪个方向浮动。
float主要的用途:
1 图片周围包围文字 (类似于word编辑中得图片浮动效果,除了图片本身占据的位置用来显示,其他位置都被其他元素占据了)
2 浮动可用于创建全部网页布局,例如sidebar
float造成的效果:
1 自身向左(右)浮动
2 因为自身的浮动,导致下面一行的元素跳到上面一行。
3 要消除对下面一行的影响,要使用 div { clear: both; }
代码示例: side bar and float
https://tutsplus.com/lesson/float ...
Meta tag viewpoint 简易的 cross-device layout 方法
<meta name="viewport" content="width=device-width, initial-scale=1">
Notes on GET:
Appends form-data into the URL in name/value pairs
The length of a URL is limited (about 3000 characters)
Never use GET to send sensitive data! (will be visible in the URL)
Useful for form submissions where a user want to bookmark the result
GET is better for non-secure data, l ...
为什么after伪元素之后content无法应用高度和宽度?
1) 想要给after的内容加上大于字体本身的宽度和高度,并给加上背景色
<div class='test'></div>
.test {
width:100px;
height:100px;
background: green;
}
.test:after {
content:"12";
background:grey;
width:50px;
height:50px;
}
显示范围只有“12”这部分,而没有50px * 50p ...
JS代码的良好的结构 https://tutsplus.com/lesson/slides-and-structure/
理解 JS 的 new 和 prototype
普通创建对象
var person = new Object();
person.firstName = "John";
person.lastName = "Deo";
person.sa ...
STEP 1 创建一个新用户,用户文件夹权限755
STEP 2 检查现有系统,关闭Apache的httpd服务,如果有
STEP 3 更新yum,安装gollum要求的gem
--->https://github.com/gollum/gollum
STEP 4 新建一个wiki directory, 并 git init . & commit. Gollum只会读取commit之后的文件。
STEP 5 配置 Nginx /etc/nginx/conf.d/default.conf
location / { ...
Nginx
Nginx如何处理一个请求 http://nginx.org/cn/docs/http/request_processing.html
Nginx 配置文件 /etc/nginx/nginx.conf
user nginx; # 使用该配置的用户,其他用户没有权限
worker_processes 1; # 开启的nginx进程数量
error_log /var/log/nginx/error.log;
pid /va ...
版本信息:
Amazon Linux
Paseenger 4.0.2
Rails 3.2.13
STEP 1 新建一个rails用户,将用户权限改为755,以便于设置Nginx Root /app/public 不会产生permission deny的问题。public文件夹能够被所有用户访问是不够的,需要所有父文件 ...
简单来说:Process.spawn = Process.fork + exec
Process.fork allows you to run ruby code in another process. Process.spawn allows you to run another program in another process. Basically Process.spawn is like using Process.fork
Thread.new([arg, ...]) { ... }
Thread.start([arg, ...]) { ... }
Thread.fork([arg, ...]) { ... }
生成线程,并开始对块进行计算.
参数会被原封不动地传递给块. 这就可以在启动线程的同时,将值传递给该线程所固有的局部变量.
返回生成的线程.
Thread.join
挂起当前线程,直到self线程终止运行为止. 若self因异常而终止时, 将会当前线程引发同样的异常.
若某线程内发生了异常,且没有被线程内的 rescue 捕捉到时,通常该线程会被停掉,而不会发出警告。但是,如果这时 ...
Process.fork{}
当block为空的时候,fork会返回2次结果,一次是在父进程中,返回子进程的pid,一次是在子进程中,返回nil。
Creates a subprocess. If a block is specified, that block is run in the subprocess, and the subprocess terminates with a status of zero.
Otherwise, the fork call returns twice, once in the parent, returning the proc ...
1 同样都是创建子进程
Process.fork{ } 是非阻塞的执行,创建的子进程与父进程并发运行,需要使用Process.wait或者Process.detach来防止产生zommbie process
Kernel#exec, Kernel#system and Backticks(%x)阻塞的执行,调用者将等待被调用的返回
2 Kernel#exec, Kernel#system and Backticks(%x) 区别
Kernel#exec 用新创建的子进程取代原来的进程
exec('ls ~')
# Nothing after this comma ...
Ruby 1.9.x开始,require 同一文件夹中的文件提示 in `require': no such file to load 错误。
解决方式:
1、用 require_relative :
require_relative 'xxx.rb'
2、往 $: 中加入目录路径:
$:.unshift File.dirname __FILE__
require 'xxx.rb'
3、或者运行ruby的时候加 -I. 参数
ruby -I. xxx.rb
-------------------------------- ...