Skip to content

Instantly share code, notes, and snippets.

View playerjamesbattleground's full-sized avatar

james jiang playerjamesbattleground

View GitHub Profile
@playerjamesbattleground
playerjamesbattleground / gist:566fa6c55a3870ad8e3db5e90d9666b0
Created May 26, 2022 23:56 — forked from rxaviers/gist:7360908
Complete list of github markdown emoji markup

People

:bowtie: :bowtie: 😄 :smile: 😆 :laughing:
😊 :blush: 😃 :smiley: ☺️ :relaxed:
😏 :smirk: 😍 :heart_eyes: 😘 :kissing_heart:
😚 :kissing_closed_eyes: 😳 :flushed: 😌 :relieved:
😆 :satisfied: 😁 :grin: 😉 :wink:
😜 :stuck_out_tongue_winking_eye: 😝 :stuck_out_tongue_closed_eyes: 😀 :grinning:
😗 :kissing: 😙 :kissing_smiling_eyes: 😛 :stuck_out_tongue:
@playerjamesbattleground
playerjamesbattleground / build-pipeline
Last active October 18, 2017 03:01
anypoint-cli involved build pipeline
File
@playerjamesbattleground
playerjamesbattleground / Dockerfile
Created September 27, 2017 03:25
Simple Dockerfile makes anypoint-cli executable
FROM node:6.11
RUN npm install -g anypoint-cli
ENTRYPOINT [ "anypoint-cli" ]
@playerjamesbattleground
playerjamesbattleground / JsonObjectIterator.groovy
Created July 21, 2016 14:52
Used as Groovy Component in MuleESB Application
/**
* @see <a href="http://stackoverflow.com/questions/6511880/how-to-parse-a-json-input-stream">how-to-parse-a-json-input-stream</a>
* @see <a href="http://stackoverflow.com/questions/24835431/use-jackson-to-stream-parse-an-array-of-json-objects">use-jackson-to-stream-parse-an-array-of-json-objects</a>
* @author BoostHungry <a href="http://stackoverflow.com/users/1110526/boosthungry">BoostHungry</a>
* @author Ian Roberts <a href="http://stackoverflow.com/users/592139/ian-roberts">Ian Roberts</a>
* @author leijiang
*
*/
import static org.apache.commons.lang.StringUtils.*
@playerjamesbattleground
playerjamesbattleground / 7-zip-encrypted-compression
Last active June 26, 2016 14:13
property-management-blog-snippet
7z a <<compressed_file_name>>.7z path/to/secret/file(s) -p<<password string>>
package test.me.sftp;
import java.io.IOException;
import java.security.PublicKey;
import java.util.Arrays;
import org.apache.sshd.common.NamedFactory;
import org.apache.sshd.server.Command;
import org.apache.sshd.server.SshServer;
import org.apache.sshd.server.auth.password.PasswordAuthenticator;
@playerjamesbattleground
playerjamesbattleground / SftpServiceTest.java
Created June 2, 2016 02:44 — forked from ToastShaman/SftpServiceTest.java
Using an embedded Apache MINA SSHD server in a unit test to verify that your code is able to upload a file through SFTP. This unit tests uses JSch as the client to speak to an embedded Apache MINA sftp server and verifies that the upload of a text file was successful.
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.equalTo;
import java.io.File;
import java.io.IOException;
import java.io.OutputStream;
import java.nio.charset.StandardCharsets;
import java.util.Arrays;

Routes

小心地使用 Match(Rails 3 已实现)

Rails 3 提供了 match 方法供我们自定义 routes,然而我们要小心使用它以避免“跨站脚本攻击”(XSS Attack)。比如像这样的 routes:

注:(r3 代表 Rails 3,r4 代表 Rails 4)

# routes.rb
@playerjamesbattleground
playerjamesbattleground / 0_reuse_code.js
Last active August 29, 2015 14:07
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
import groovy.util.XmlSlurper;
import org.apache.commons.lang3.StringUtils;
class Xml2MapHelper {
def log = org.slf4j.LoggerFactory.getLogger(getClass())
/*
* these functions only return list of maps which contains the bottom level key-value pairs,
* ie. convert whatever input xml into a key:list<map> structure