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 ab2str(buf) { | |
return String.fromCharCode.apply(null, new Uint8Array(buf)); | |
} | |
function ajaxDownload(url, params, successCallback, errorCallback){ | |
var xhr = new XMLHttpRequest(); | |
xhr.open('POST', url, true); | |
xhr.responseType = 'arraybuffer'; | |
xhr.onload = function () { | |
if (this.status === 200) { | |
var type = xhr.getResponseHeader('Content-Type'); |
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
adb logcat *:S ReactNative:V ReactNativeJS:V |
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
# Fucking scripts to download from chiasenhac, whole album! | |
import os | |
from bs4 import BeautifulSoup | |
import requests | |
from multiprocessing import Pool | |
NUMBER_PROCESS = 8 | |
MUSIC_QUALITY = '320' |
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
#!/usr/bin/env python | |
# -*- coding: utf-8 -*- | |
import os | |
import sys | |
import re | |
import argparse | |
import errno | |
import requests | |
from bs4 import BeautifulSoup |
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
#Compile rsync 3.1.2 | |
#Follow these instructions in Terminal on both the client and server to download and compile rsync 3.1.2: | |
#Download and unarchive rsync and its patches | |
curl -O http://rsync.samba.org/ftp/rsync/src/rsync-3.1.2.tar.gz | |
tar -xzvf rsync-3.1.2.tar.gz | |
rm rsync-3.1.2.tar.gz | |
curl -O http://rsync.samba.org/ftp/rsync/src/rsync-patches-3.1.2.tar.gz | |
tar -xzvf rsync-patches-3.1.2.tar.gz |
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 urllib2 | |
from bs4 import BeautifulSoup | |
BASE_URL = 'http://isach.info/mobile/story.php?story=tru_tien_2__tieu_dinh&chapter=' | |
CHAPTER_START = 2 | |
def main(): | |
chapters = get_chapters_arr() |
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 AppZip | |
{ | |
List<String> fileList; | |
private static final String OUTPUT_ZIP_FILE = "C:\\MyFile.zip"; | |
private static final String SOURCE_FOLDER = "C:\\testzip"; | |
AppZip(){ | |
fileList = new ArrayList<String>(); | |
} |
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
Image.getSize(this.props.image, (srcWidth, srcHeight) => { | |
const maxHeight = Dimensions.get('window').height; | |
const maxWidth = Dimensions.get('window').width; | |
const ratio = Math.min(maxWidth / srcWidth, maxHeight / srcHeight); | |
this.setState({ width: srcWidth * ratio, height: srcHeight * ratio }); | |
}, error => { | |
console.log('error:', error); | |
}); |
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
componentDidMount() { | |
StatusBar.setHidden(true); | |
} |
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
var a = () => Promise.resolve(1); | |
var b = () => Promise.reject(new Error(2)); | |
var c = () => Promise.resolve(3); | |
Promise.all([a(), b(), c()].map(p => p.catch(e => e))) | |
.then(results => console.log(results)) // 1,Error: 2,3 | |
.catch(e => console.log(e)); | |
var console = { log: msg => div.innerHTML += msg + "<br>"}; |