Skip to content

Instantly share code, notes, and snippets.

View bootstrap_start_template.html
<!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>
View string_test_case.py
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])
View bootstrap_blank_template_v3.3.7.html
<!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 Nov 26, 2015 — forked from nghuuphuoc/1) Install
Install Redis on Centos 6
View 1) Install
// --- 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 Dec 12, 2019
python selenium expected_conditions examples
View expected_conditions_example.py
#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
View rspec_model_testing_template.rb
# 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 Mar 17, 2015
mina发布到多台机器的脚本
View multi_mina.rb
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 Dec 15, 2014
tableless没有数据库table的model
View stock_config.rb
class StockConfig
include ActiveModel::Validations
include ActiveModel::Conversion
extend ActiveModel::Naming
include Virtus.model
attribute :money, Integer
attribute :month, Integer
attribute :policy_id, Integer
View pyunit_start_point.py
#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 Sep 5, 2014
how to implement insert sort using c
View insert_sort.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) {