Skip to content

Instantly share code, notes, and snippets.

<!DOCTYPE html>
<html lang="en">
<head>
<!-- Required meta tags -->
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<!-- Bootstrap CSS -->
<link rel="stylesheet" href="https://cdn.bootcss.com/bootstrap/4.0.0-alpha.6/css/bootstrap.min.css" integrity="sha384-rwoIResjU2yc3z8GV/NPeZWAv56rSmLldC3R/AZzGRnGxQQKnKkoFVhFQhNUwEyJ" crossorigin="anonymous">
</head>
import unittest
class StringTestCase(unittest.TestCase):
def setUp(self):
self.test_string = "This is a string"
def testReverse(self):
self.assertEqual("gnirts a si sihT", self.test_string[::-1])
@easonhan007
easonhan007 / bootstrap_blank_template_v3.3.7.html
Created January 29, 2017 09:36
bootstrap blank template v3.3.7
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- The above 3 meta tags *must* come first in the head; any other head content must come *after* these tags -->
<title>Bootstrap 101 Template</title>
<!-- Bootstrap -->
@easonhan007
easonhan007 / 1) Install
Created November 26, 2015 22:34 — forked from nghuuphuoc/1) Install
Install Redis on Centos 6
// --- Compiling ---
$ wget http://download.redis.io/releases/redis-2.8.3.tar.gz
$ tar xzvf redis-2.8.3.tar.gz
$ cd redis-2.8.3
$ make
$ make install
// --- or using yum ---
$ rpm -Uvh http://download.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm
$ rpm -Uvh http://rpms.famillecollet.com/enterprise/remi-release-6.rpm
@easonhan007
easonhan007 / expected_conditions_example.py
Last active December 12, 2019 11:58
python selenium expected_conditions examples
#encoding:utf-8
# example of how to use https://github.com/SeleniumHQ/selenium/blob/master/py/selenium/webdriver/support/expected_conditions.py
from selenium import webdriver
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.support.wait import WebDriverWait
from selenium.webdriver.common.by import By
import unittest
# This is a skeleton for testing models including examples of validations, callbacks,
# scopes, instance & class methods, associations, and more.
# Pick and choose what you want, as all models don't NEED to be tested at this depth.
#
# I'm always eager to hear new tips & suggestions as I'm still new to testing,
# so if you have any, please share!
#
# @kyletcarlson
#
# This skeleton also assumes you're using the following gems:
@easonhan007
easonhan007 / multi_mina.rb
Created March 17, 2015 02:12
mina发布到多台机器的脚本
def load_config(server)
thirdpillar_config =YAML.load(File.open('config/mina.yml'))
puts "———-> configuring #{server} server"
set :domain, thirdpillar_config[server]['domain'] #retriving the domain value for current server
set :deploy_to, thirdpillar_config[server]['deploy_to'] #retriving the deploy_to value for current server
set :repository, thirdpillar_config[server]['repository']
set :branch, thirdpillar_config[server]['branch']
end
server = ENV['MINA_ENV'] || 'staging'
@easonhan007
easonhan007 / stock_config.rb
Created December 15, 2014 07:57
tableless没有数据库table的model
class StockConfig
include ActiveModel::Validations
include ActiveModel::Conversion
extend ActiveModel::Naming
include Virtus.model
attribute :money, Integer
attribute :month, Integer
attribute :policy_id, Integer
@easonhan007
easonhan007 / pyunit_start_point.py
Created October 26, 2014 11:42
pyunit start point
#coding: utf-8
import unittest
from selenium import webdriver
import time
class LoginCase(unittest.TestCase):
def setUp(self): #每个用例执行之前执行
print 'before test'
@easonhan007
easonhan007 / insert_sort.c
Created September 5, 2014 14:00
how to implement insert sort using c
#include <stdio.h>
int main() {
int arr[] = {1, 8, 9, 4, 8, 7, 2, 3, 4, 90, 34};
int len = sizeof(arr) / sizeof(arr[0]);
int i;
for(i = 1; i < len - 1; i++) {
int key = arr[i];
int j = i - 1;
while(arr[j] > key && j >=0) {