Skip to content

Instantly share code, notes, and snippets.

View jiangtao's full-sized avatar
:octocat:
但行好事,也问前程。Up!Up!Up!

jiangtao

:octocat:
但行好事,也问前程。Up!Up!Up!
View GitHub Profile
@jiangtao
jiangtao / gist:ca26f34dc18214313585
Created January 28, 2016 12:49 — forked from mharsch/gist:5188206
serve HLS (HTTP Live Streaming) content from node.js

HLS streaming from node

Provided that you already have a file or stream segmenter generating your .m3u8 playlist and .ts segment files (such as the ffmpeg 'hls' muxer), this little node server will serve up those files to an HLS compatible client (e.g. Safari). If you're using node for your streaming app already, this obviates the need to serve the HLS stream from a separate web server.

loosely based on https://gist.github.com/bnerd/2011232

// loosely based on https://gist.github.com/bnerd/2011232
// requires node.js >= v0.10.0
// assumes that HLS segmenter filename base is 'out'
// and that the HLS playlist and .ts files are in the current directory
// example:
// phantomjs getComputedStyle.js "http://www.iqiyi.com/" ".usrTxGeneral-box_hover" "position,display,visibility,overflow"
var TIMEOUT = 60 * 1000;
var webPage = require('webpage');
var system = require('system');
var page = webPage.create();
page.settings.loadImages = false;
@jiangtao
jiangtao / gh-pages-deploy.md
Created March 28, 2017 08:01 — forked from cobyism/gh-pages-deploy.md
Deploy to `gh-pages` from a `dist` folder on the master branch. Useful for use with [yeoman](http://yeoman.io).

Deploying a subfolder to GitHub Pages

Sometimes you want to have a subdirectory on the master branch be the root directory of a repository’s gh-pages branch. This is useful for things like sites developed with Yeoman, or if you have a Jekyll site contained in the master branch alongside the rest of your code.

For the sake of this example, let’s pretend the subfolder containing your site is named dist.

Step 1

Remove the dist directory from the project’s .gitignore file (it’s ignored by default by Yeoman).

(function (win) {
var ratio, scaleValue, renderTime,
document = window.document,
docElem = document.documentElement,
vpm = document.querySelector('meta[name="viewport"]');
if (vpm) {
var tempArray = vpm.getAttribute("content").match(/initial\-scale=(["']?)([\d\.]+)\1?/);
if (tempArray) {
scaleValue = parseFloat(tempArray[2]);
ratio = parseInt(1 / scaleValue);
@jiangtao
jiangtao / flexbox.less
Created May 5, 2017 03:18 — forked from jayj/flexbox.less
CSS3 Flexbox - LESS Mixins
// --------------------------------------------------
// Flexbox LESS mixins
// The spec: http://www.w3.org/TR/css3-flexbox
// --------------------------------------------------
// Flexbox display
// flex or inline-flex
.flex-display(@display: flex) {
display: ~"-webkit-@{display}";
display: ~"-ms-@{display}box"; // IE10 uses -ms-flexbox
@jiangtao
jiangtao / convert.sh
Last active July 31, 2017 09:34
pandoc convert
#!/bin/bash
from="src"
to="dist"
type="docx"
# 检测brew
if ! command -v brew >/dev/null 2>&1; then
echo "brew没有安装,请安装"
exit 0
fi
@jiangtao
jiangtao / object.js
Created August 10, 2017 03:46
simple uri object setter and getter
const PATH = require('path')
function set(obj, path, value) {
let keys = PATH.normalize(path).split('/').filter(Boolean)
let k
while(keys.length) {
k = keys.shift()
if(!obj[k] || typeof obj[k] != 'object') {
obj[k] = keys.length == 0 ? value : {}
}
@jiangtao
jiangtao / index.pug
Created August 22, 2017 10:24
WIP: Gyro fill effect
h2 Gyro filling
.progress-badge.js-progress-badge.is-filling.is-filling-from-empty
// BADGE
.badge.badge--empty
.badge__fill.js-badge-gyro
.badge__fill-inner
@jiangtao
jiangtao / cloudSettings
Last active July 14, 2020 06:25
Visual Studio Code Settings Sync Gist
{"lastUpload":"2020-01-30T15:00:17.026Z","extensionVersion":"v3.4.3"}
@jiangtao
jiangtao / nginx_vue_history.conf
Created November 14, 2017 06:39
nginx vue history conf
server {
listen 8100;
root $HOME/Places/Code/pay-day-loan/dist;
index index.html
server_name 127.0.0.1;
location / {
try_files $uri $uri/ @rewrites;
}
location @rewrites {