Skip to content

Instantly share code, notes, and snippets.

@alanland
alanland / docker-compose.yml
Created Dec 13, 2019 — forked from pantsel/docker-compose.yml
example docker-compose.yml for kong, postgres and konga
View docker-compose.yml
version: "3"
networks:
kong-net:
driver: bridge
services:
#######################################
# Postgres: The database used by Kong
View Install-Docker-on-Linux-Mint.sh
##########################################
# To run:
# curl -sSL https://gist.githubusercontent.com/sirkkalap/e87cd580a47b180a7d32/raw/d9c9ebae4f5cf64eed4676e8aedac265b5a51bfa/Install-Docker-on-Linux-Mint.sh | bash -x
##########################################
# Check that HTTPS transport is available to APT
if [ ! -e /usr/lib/apt/methods/https ]; then
sudo apt-get update
sudo apt-get install -y apt-transport-https
fi
View install.sh
# Modify /etc/yum.repos.d/epel.repo. Under the section marked [epel], change enabled=0 to enabled=1.
sudo yum install erlang --enablerepo=epel
wget http://www.rabbitmq.com/releases/rabbitmq-server/v3.1.1/rabbitmq-server-3.1.1-1.noarch.rpm
sudo rpm -Uvh rabbitmq-server-3.1.1-1.noarch.rpm
# Enable managament plugin
sudo rabbitmq-plugins enable rabbitmq_management
View local-selenium.md
$ brew install selenium-server-standalone chromedriver
$ git clone git@github.com:theintern/intern.git
$ cd intern
$ npm install --production
$ ln -s .. node_modules/intern
$ curl https://gist.github.com/neonstalwart/6630466/raw/f0e4e4efbefa40c746f7c68e2bb4fa0dd5215047/selftest.local.intern.js > tests/selftest.local.intern.js
$ java -jar /usr/local/opt/selenium-server-standalone/selenium-server-standalone-2.35.0.jar -p 4444 &
$ node node_modules/intern/runner.js config=tests/selftest.local.intern
View ShiroDuiTabLib.groovy
def permissionSelect = { attrs ->
def allPerms = ((attrs.value ?: []) + grailsApplication.controllerClasses.findAll {
it.propertyName != "authController"
}.collect { controller ->
def base = controller.propertyName - 'Controller';
controller.getURIs().collect {
def action = it.split('\\/')
action = (action.size() == 2 ? "*" : action[2])
"${base}:${action}"
}
View Douban_movie_query.py
#! /usr/bin/env python
# coding=utf-8
__author__ = 'jszhou'
from bottle import *
import hashlib
import xml.etree.ElementTree as ET
import urllib2
# import requests
import json
@alanland
alanland / extendTree.js
Created Aug 23, 2013
Dojo Tree.refresh
View extendTree.js
require(["dojo/_base/lang", "dijit/Tree"], function(lang, Tree){
lang.extend(Tree, {
refresh : function() {
// Destruct the references to any selected nodes so that
// the refreshed tree will not attempt to unselect destructed nodes
// when a new selection is made.
// These references are contained in Tree.selectedItem,
// Tree.selectedItems, Tree.selectedNode, and Tree.selectedNodes.
this.dndController.selectNone();
@alanland
alanland / String.js
Created Aug 15, 2013
JS 基础类扩展
View String.js
// 计算长度,中文当作两个长度
String.prototype.len = function () {return this.replace(/[^\x00-\xff]/g, "**").length};
"哈哈asd哈哈".len();
@alanland
alanland / DoYouKnowJs.js
Created Aug 6, 2013
So, you think you know JavaScript?
View DoYouKnowJs.js
if (!("a" in window)) {
var a = 1;
}
alert(a);
var a = 1,
b = function a(x) {
x && a(--x);
};
View build.gradle
rootProject.name = 'project1'
archivesBaseName = 'project1'
jar.baseName = 'project1'
// -- full file
apply plugin: 'java'
apply plugin: 'maven'
archivesBaseName = 'project1'
version = '1.0-SNAPSHOT'