// refs:
// 1. https://gist.github.com/mikaelbr/9900818
// 2. https://medium.com/@pyrolistical/destructuring-nested-objects-9dabdd01a3b8
This file contains 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 ruby | |
require 'tempfile' | |
require 'fileutils' | |
# Signals | |
trap("SIGINT") { exit } | |
# Setup | |
TARGET_FOLDER = ARGV[0] | |
TARGET_URL = ARGV[1] |
This file contains 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
% https://tex.stackexchange.com/questions/11866/compile-a-latex-document-into-a-png-image-thats-as-short-as-possible | |
% 实际使用,不需要设置 size | |
% density 还是需要的 | |
% 如果必要,需要支持中文,以及 ams math 等 | |
\documentclass[convert={density=300,size=1080x800,outext=.png}]{standalone} | |
\begin{document} | |
Hello. This is a test. | |
\begin{equation} | |
L = 2 | |
\end{equation} |
This file contains 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 | |
''' | |
NAME | |
latex2png - Converts LaTeX source to PNG file | |
SYNOPSIS | |
latex2png [options] INFILE | |
DESCRIPTION | |
This filter reads LaTeX source text from the input file |
This file contains 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
#!/bin/bash | |
alias latex='/usr/bin/latex' | |
alias dvipng='/usr/bin/dvipng' | |
alias convert='/usr/bin/convert' | |
#choose a number from 75-300 | |
density=300 | |
if [ $# != 2 ] | |
then | |
echo "Usage: $0 output_file latex_code" |
This file contains 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
# Usage: | |
# ruby latex_server.rb | |
# | |
# Try: <img src="http://localhost:4567/\cos \frac{\pi}{2} = 0"> | |
# Get: A nice looking png of: cos(pi/2) = 0 | |
# | |
# Bug1: Ellipses (...) don't work. Probably the way urls are parsed | |
# b |
This file contains 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
/** | |
* 方案二: | |
* 使用 FlatList 来实现的无限滚动列表 | |
*/ | |
import React, { Component } from "react"; | |
import { | |
View, | |
Text, |
This file contains 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
/** | |
* 使用 Animated View 实现的轮播 | |
* 嵌套在 ListView/FlatList 中效果不好! | |
*/ | |
'use strict'; | |
var React = require('react'); | |
import { | |
AppRegistry, | |
StyleSheet, |
This file contains 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 React, { Component } from 'react'; | |
import { | |
StyleSheet, | |
Image, | |
View, | |
Dimensions, | |
TouchableWithoutFeedback, | |
} from 'react-native'; |
NewerOlder