This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import logging | |
import cherrypy | |
from cherrypy.process import plugins | |
class ADPHttpFacetPlugin(plugins.SimplePlugin): | |
def __init__(self, bus): | |
plugins.SimplePlugin.__init__(self, bus) | |
self.logger = logging.getLogger(__name__) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# https://stackoverflow.com/questions/13484206/cherrypy-url-dispatcher | |
import cherrypy | |
class City: | |
def __init__(self, name): | |
self.name = name | |
self.population = 10000 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class SnowFlakeIdWorker { | |
private final long workerId; | |
private final static long twepoch = 1390838400000L; | |
private Long sequence = 0L; | |
private final static long workerIdBits = 4L; | |
public final static long maxWorkerId = -1L ^ -1L << workerIdBits; | |
private final static long sequenceBits = 10L; | |
private final static long workerIdShift = sequenceBits; | |
private final static long timestampLeftShift = sequenceBits + workerIdBits; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
#include <thread> | |
using namespace std; | |
int _id = 1; | |
class Person | |
{ | |
public: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
set nu | |
set autochdir | |
set encoding=utf-8 | |
set fileencoding=utf-8 | |
set ai | |
set si | |
set ts=4 | |
set st=4 | |
set sw=4 | |
set et |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Become root first ! | |
$ mkdir /etc/ssl/self-signed && cd /etc/ssl/self-signed | |
$ openssl genrsa -des3 -out server.key 1024 | |
$ openssl rsa -in server.key -out server.key.insecure | |
$ mv server.key server.key.secure && mv server.key.insecure server.key | |
$ openssl req -new -key server.key -out server.csr | |
$ openssl x509 -req -days 365 -in server.csr -signkey server.key -out server.crt |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function(priority) {console.log(priority); return priority && + priority | 0 || 0; })() | |
// undefined | |
// 0 | |
(function(priority) {console.log(priority); return priority && + priority | 0 || 0; })(45) | |
// 45 | |
// 45 | |
(function(priority) {console.log(priority); return priority && + priority | 0 || 0; })('a') | |
// a |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
int fit = false; | |
this->testLabel->setText(""); | |
QLabel *myLabel = this->testLabel; | |
QFont myFont = myLabel->font(); | |
QString str = "this is the new string. this is the new string. this is the new string. super long. don't fit. please please please overflow the box"; | |
while (!fit) | |
{ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="utf-8"> | |
<title>KISSY MINI Mobile Demo Template</title> | |
<!-- | |
width=device-width:让文档的宽度与设备的宽度保持一致,且文档最大的宽度比例是1.0 | |
initial-scale=1:初始的缩放比例 | |
maximum-scale=1:允许用户缩放到的最大比例(对应还有个minimum-scale) | |
user-scalable=no:不允许用户手动缩放 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Tox (http://tox.testrun.org/) is a tool for running tests | |
# in multiple virtualenvs. This configuration file will run the | |
# test suite on all supported python versions. To use it, "pip install tox" | |
# and then run "tox" from this directory. | |
[tox] | |
skipsdist = True |
NewerOlder