Skip to content

Instantly share code, notes, and snippets.

View YSMull's full-sized avatar
🎯
Focusing

ysmull YSMull

🎯
Focusing
View GitHub Profile
@YSMull
YSMull / Hello World!
Last active August 29, 2015 13:56
a C++ code for test!
#include<iostream>
using namespace std;
int main()
{
cout<<"Hello World!"<<endl;
return 0;
}
###hehe
@YSMull
YSMull / readme.md
Created February 14, 2014 14:54
markdown test

Header 1

Header 2

Header 3 ### (Hashes on right are optional)

Header 4

Header 5

Markdown plus h2 with a custom ID ## {#id-goes-here}

Link back to H2

This is a paragraph, which is text surrounded by whitespace. Paragraphs can be on one

package chkr;
@FunctionalInterface
interface CheckedFunction<T, R> {
R apply(T t) throws Exception;
}
package chkr;
import java.util.function.Function;
@FunctionalInterface
interface CheckedFunction<T> {
T apply(T t) throws Exception;
}
public class Chkr {
import java.net.URL;
import java.net.URLClassLoader;
import java.sql.Connection;
import java.sql.Driver;
import java.sql.SQLException;
import java.util.Properties;
public class Test {
private static void tryConnect(Properties props, String... libs) throws ClassNotFoundException, InstantiationException, IllegalAccessException, SQLException {
@YSMull
YSMull / ExperimentMultiTypeConnMultiTypeConn.java
Created July 4, 2018 09:05
初步完成了一个能连接不同版本mysql的DriverPool
import java.net.URL;
import java.net.URLClassLoader;
import java.sql.Connection;
import java.sql.Driver;
import java.sql.SQLException;
import java.util.Arrays;
import java.util.Properties;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.CountDownLatch;
import com.sun.xml.internal.fastinfoset.util.CharArray;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
public class Test3 {
public static List<String> split(String s) {
List<String> res = new ArrayList<>();
@YSMull
YSMull / Solution.java
Last active August 17, 2018 03:23
寻找两个数组中是否有公共元素的递归算法
// https://leetcode.com/problems/intersection-of-two-arrays/
class Solution {
public static List<Integer> common = new ArrayList<>();
public static boolean find(int[] arr1, int i1, int j1, int[] arr2, int i2, int j2) {
if (i1 > j1 || i2 > j2) return false;
int mid1 = (i1 + j1) / 2;
int mid2 = (i2 + j2) / 2;
if (arr1[mid1] == arr2[mid2]) {
common.add(arr1[mid1]);
const co = require('co')
var count = 975;
let test_co = co.wrap(function* (n) {
if (n == count)
return;
yield test_co(n + 1);
});
@YSMull
YSMull / awaitExtractSugar.js
Last active December 28, 2018 09:40
let M = await N 的解糖模式应该是: new Promise((resolve, reject)=>{resolve(N)}).then(M => {...})
let yyy = async function() {
return 123;
}
let multipleAwait = async function () {
let a = await yyy();
let b = await yyy();
console.log(a+b);
}