Skip to content

Instantly share code, notes, and snippets.

🎯
Focusing

TANG SHIQIANG tsq

🎯
Focusing
Block or report user

Report or block tsq

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@tsq
tsq / blog_2019-05-29_manifest.json
Created May 31, 2019
the content of manifest.json
View blog_2019-05-29_manifest.json
{
"name": "COINMARKET",
"short_name": "COINMARKET",
"description": "An App that displays the mark cap rankings, price, details and more for the top 100 larget crytocurrencies based on overall market cap.",
"icons": [
{
"src": "./img/icons/android-chrome-192x192.png",
"sizes": "192x192",
"type": "image/png"
},
View blog_2019-05-18_not-work-for-error.js
function myApiFunc(callback) {
/**
* This pattern does NOT work!
*/
try {
doSomeAsynchronousOperation(err => {
if (err) {
throw (err);
}
/* continue as normal */
@tsq
tsq / vue-router.js
Created May 23, 2018
native vue router
View vue-router.js
import Vue from 'vue';
const EventBus = new Vue();
// The onpopstate event is fired each time the active history entry
// change is invoked by clicking on the back or forward buttons
window.addEventListener('popstate', () => {
EventBus.$emit('navigate');
});
const DunkirkBlurb = {
@tsq
tsq / fix_zsh_history.sh
Created May 3, 2018 — forked from kolach/fix_zsh_history.sh
Fix for zsh: corrupt history file /home/marc/.zsh_history
View fix_zsh_history.sh
#!/bin/sh
# Borrowed from http://marcparadise.com/blog/2013/09/21/how-to-fix-a-corrupt-history-file/
# If you ever see a message like this upon starting a new shell
# zsh: corrupt history file /home/marc/.zsh_history
# here is a quick fix
cd ~
mv .zsh_history .zsh_history_bad
strings .zsh_history_bad > .zsh_history
# And reload history
fc -R .zsh_history
@tsq
tsq / detect-flex.js
Created Jun 22, 2017
using js to detect support of flexbox
View detect-flex.js
var d = document.documentElement.style
if (('flexWrap' in d) || ('WebkitFlexWrap' in d) || ('msFlexWrap' in d)){
alert('ok');
}
@tsq
tsq / in_viewport.js
Created Jun 4, 2017 — forked from jjmu15/in_viewport.js
check if element is in viewport - vanilla JS. Use by adding a “scroll” event listener to the window and then calling isInViewport().
View in_viewport.js
// Determine if an element is in the visible viewport
function isInViewport(element) {
var rect = element.getBoundingClientRect();
var html = document.documentElement;
return (
rect.top >= 0 &&
rect.left >= 0 &&
rect.bottom <= (window.innerHeight || html.clientHeight) &&
rect.right <= (window.innerWidth || html.clientWidth)
);
@tsq
tsq / MIT-LICENSE.txt
Created Mar 6, 2017 — forked from jgarber/MIT-LICENSE.txt
Responsive video
View MIT-LICENSE.txt
Copyright (c) 2011 ZURB, http://www.zurb.com/
@tsq
tsq / redis.markdown
Created Dec 14, 2016 — forked from bdotdub/redis.markdown
Running redis using upstart on Ubuntu
View redis.markdown

Running redis using upstart on Ubuntu

I've been trying to understand how to setup systems from the ground up on Ubuntu. I just installed redis onto the box and here's how I did it and some things to look out for.

To install:

@tsq
tsq / qs.html
Created Dec 27, 2015
get qs args
View qs.html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title></title>
</head>
<body>
<script>
// query string arguments
View gulpfile.less.js
var gulp = require('gulp');
var less = require('gulp-less');
var sourcemaps = require('gulp-sourcemaps');
var LessPluginCleanCSS = require("less-plugin-clean-css"),
cleancss = new LessPluginCleanCSS({advanced: true});
var LessPluginAutoPrefix = require('less-plugin-autoprefix'),
autoprefix = new LessPluginAutoPrefix({browsers: ["last 2 versions"]});
gulp.task('default', function () {
gulp.src('./less/project.less')
You can’t perform that action at this time.