Skip to content

Instantly share code, notes, and snippets.

@z007
z007 / README.md
Created February 20, 2017 16:58 — forked from fnichol/README.md
Download a cacert.pem for RailsInstaller

Why?

There is a long standing issue in Ruby where the net/http library by default does not check the validity of an SSL certificate during a TLS handshake. Rather than deal with the underlying problem (a missing certificate authority, a self-signed certificate, etc.) one tends to see bad hacks everywhere. This can lead to problems down the road.

From what I can see the OpenSSL library that Rails Installer delivers has no certificate authorities defined. So, let's go fetch some from the curl website. And since this is for ruby, why don't we download and install the file with a ruby script?

Installation

The Ruby Way! (Fun)

@z007
z007 / JavaScript去除字符串l两边空格trim.txt
Last active October 24, 2016 06:25
JavaScript去除字符串两边空格 两边trim
http://www.nowamagic.net/javascript/js_TrimInJavascript.php
<script type="text/javascript">
  function trim(str){ //删除左右两端的空格
  return str.replace(/(^\s*)|(\s*$)/g, "");
  }
  function ltrim(str){ //删除左边的空格
  return str.replace(/(^\s*)/g,"");
  }
  function rtrim(str){ //删除右边的空格
#PyCharm 建立项目创建虚拟环境 不勾选Inherit global site-packages
home = C:\Python35-32
include-system-site-packages = false
version = 3.5.1
#PyCharm 建立项目创建虚拟环境 勾选Inherit global site-packages
home = C:\Python35-32
include-system-site-packages = true
version = 3.5.1
@z007
z007 / echo.php
Last active August 29, 2015 14:19
echo 'ssh gist';
echo "yes ok";
echo "hello php";
echo ""hello php";
@z007
z007 / 0_reuse_code.js
Last active August 29, 2015 14:17
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@z007
z007 / time.txt
Created December 1, 2014 09:58
时间 简写格式
%a 星期几的简写
%A 星期几的全称
%b 月份的简写
%B 月份的全称
%c 标准的日期的时间串
%C 年份的后两位数字
%d 十进制表示的每月的第几天
%D 月/天/年
%e 在两字符域中,十进制表示的每月的第几天
%F 年-月-日
@z007
z007 / sublime快捷键.txt
Last active August 29, 2015 14:08
常用网站分类
Sublime(前端开发工具 及其方便) http://www.imooc.com/learn/40
快捷键:
ctrl+N
ctrl+shift+p 打开命令窗口(相当于工具->命令面板)
编辑器右下角有个编辑语言选择 也可在命令窗口输入( ctrl+shift+P )输入ss即代表 (set syntax)//syntax语法
首选ctrl+E标记自动补齐标签
@z007
z007 / 正则表达式常用功能.txt
Last active August 29, 2015 14:08
正则表达式常用功能 分析讲解 实例
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>多种信息格式验证</title>
<style type="text/css">
span{ color:#00FF33}
</style>
<script type="text/javascript">
/*//var flag=false;
@z007
z007 / IdCard.txt
Created October 29, 2014 19:01
正则表达式Id card(身份证)验证
来源:http://www.cnblogs.com/devinhua/articles/1726292.html
1、简单的正则表达式:
(1)preg_match("/^(\d{18,18}|\d{15,15}|\d{17,17}x)$/",$id_card)
(2)preg_match("/^(\d{6})(18|19|20)?(\d{2})([01]\d)([0123]\d)(\d{3}) (\d|X)?$/",$id_card)
(3)preg_match("/(^\d{15}$/)|(\d{17}(?:\d|x|X)$/),$id_card)