Skip to content

Instantly share code, notes, and snippets.

View manxisuo's full-sized avatar
🎯
Focusing

Su Yun manxisuo

🎯
Focusing
View GitHub Profile
@JohannesHoppe
JohannesHoppe / settings.json
Created May 18, 2016 12:04
VSCode: proxy settings
// VSCode: Place your settings in this file to overwrite the default settings
{
"http.proxy": "http://user:pass@proxy.com:8080",
"https.proxy": "http://user:pass@proxy.com:8080",
"http.proxyStrictSSL": false
}
/*
* Copyright (c) 2010 Apple Inc. All rights reserved.
*/
function characterNeedsScoreMultiplier(e) {
if (!e || e.length === 0)
return !1;
var t = e.charCodeAt(0);
return t > 11904 && t < 12031?!0 : t > 12352 && t < 12543?!0 : t > 12736 && t < 19903?!0 : t > 19968 && t < 40959?!0 : t > 44032 && t < 55215?!0 : t > 63744 && t < 64255?!0 : t > 65072 && t < 65103?!0 : t > 131072 && t < 173791?!0 : t > 194560 && t < 195103?!0 : !1
}
function domDistance(e, t, n) {
@madan712
madan712 / DocReader.java
Last active December 29, 2022 21:27
Java program to read doc or docx file
import java.io.File;
import java.io.FileInputStream;
import java.util.List;
import org.apache.poi.hwpf.HWPFDocument;
import org.apache.poi.hwpf.extractor.WordExtractor;
import org.apache.poi.xwpf.usermodel.XWPFDocument;
import org.apache.poi.xwpf.usermodel.XWPFParagraph;
public class DocReader {
@manxisuo
manxisuo / JXParser.js
Last active August 29, 2015 13:57
Convert JSON to XML & Convert XML to JSON (JSON和XML相互转化)
/*
使用方法:
1. 将XML转为JS对象:
JXParser.xml2Json(xml);
2. 将JS对象或JSON字符串转为XML:
JXParser.xml2Json(xml);
*/
@opnchaudhary
opnchaudhary / ftp_uploader.py
Created March 15, 2014 03:11
A sample example for uploading files using ftp in python
#!/usr/bin/python
import ftplib
session = ftplib.FTP('example.com','username','password')
file = open('cup.mp4','rb') # file to send
session.storbinary('STOR '+'cup.mp4', file) # send the file
file.close() # close file and FTP
session.quit()
@willurd
willurd / web-servers.md
Last active July 23, 2024 17:12
Big list of http static server one-liners

Each of these commands will run an ad hoc http static server in your current (or specified) directory, available at http://localhost:8000. Use this power wisely.

Discussion on reddit.

Python 2.x

$ python -m SimpleHTTPServer 8000
@lethargicpanda
lethargicpanda / OAuthActivity.java
Created December 25, 2011 23:48
OAuthActivity implements OAuth logg in in your Android application
public class OAuthActivity extends Activity {
public static String OAUTH_URL = "https://github.com/login/oauth/authorize";
public static String OAUTH_ACCESS_TOKEN_URL = "https://github.com/login/oauth/access_token";
public static String CLIENT_ID = "YOUR_CLIENT_ID";
public static String CLIENT_SECRET = "YOUR_CLIENT_SECRET";
public static String CALLBACK_URL = "http://localhost";
@Override
@remy
remy / audiosprite.js
Created December 23, 2010 13:54
An example of how an audio sprite can be used (includes fixes for iOS)
function Track(src, spriteLength, audioLead) {
var track = this,
audio = document.createElement('audio');
audio.src = src;
audio.autobuffer = true;
audio.load();
audio.muted = true; // makes no difference on iOS :(
/* This is the magic. Since we can't preload, and loading requires a user's
input. So we bind a touch event to the body, and fingers crossed, the