Skip to content

Instantly share code, notes, and snippets.

@jinwei233
jinwei233 / watch.rb
Created February 13, 2018 08:59 — forked from JamieMason/watch.rb
mac上监控文件变化,并刷新页面 Watch a folder for changes to files, then reload Chrome
#!/usr/bin/env ruby
require 'tempfile'
require 'fileutils'
# Signals
trap("SIGINT") { exit }
# Setup
TARGET_FOLDER = ARGV[0]
TARGET_URL = ARGV[1]
@jinwei233
jinwei233 / es6_destructuring.org
Last active November 29, 2017 08:17
es6 解构特性优化代码的可读性

http://pub.idqqimg.com/pc/misc/files/20171129/fdae16a6489944a29e5b3836193d6337.png

// refs: 
// 1. https://gist.github.com/mikaelbr/9900818
// 2. https://medium.com/@pyrolistical/destructuring-nested-objects-9dabdd01a3b8
% 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}
#!/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
@jinwei233
jinwei233 / latex2png.sh
Created November 15, 2017 07:33 — forked from wx13/latex2png.sh
bash script to convert a latex equation into a png image
#!/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"
@jinwei233
jinwei233 / latex_server.rb
Created November 15, 2017 07:32 — forked from farleyknight/latex_server.rb
Latex server. Pass equations, get pngs
# 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
@jinwei233
jinwei233 / FlatListDemo.js
Last active August 2, 2017 13:58
FlatListView vs ListView infinite list demo
/**
* 方案二:
* 使用 FlatList 来实现的无限滚动列表
*/
import React, { Component } from "react";
import {
View,
Text,
@jinwei233
jinwei233 / Pager.jsx
Last active June 30, 2017 12:12
使用 Animated 实现的轮播组件
/**
* 使用 Animated View 实现的轮播
* 嵌套在 ListView/FlatList 中效果不好!
*/
'use strict';
var React = require('react');
import {
AppRegistry,
StyleSheet,
@jinwei233
jinwei233 / react-native-swiper-demo.jsx
Created June 30, 2017 11:56
react-native-swiper demo ,处理更新导致 android 不能显示图片的问题
import React, { Component } from 'react';
import {
StyleSheet,
Image,
View,
Dimensions,
TouchableWithoutFeedback,
} from 'react-native';