Skip to content

Instantly share code, notes, and snippets.

View tsq's full-sized avatar
🏠
Working from home

TANG SHI QIANG tsq

🏠
Working from home
View GitHub Profile
@tsq
tsq / .gitignore
Created July 8, 2015 01:54
gitignore
.idea
node_modules
dist
bower_components
.DS_Store
doc
.idea
node_modules
dist
bower_components
.DS_Store
doc
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title></title>
<style>
* {
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
box-sizing: border-box;
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title></title>
</head>
<body>
<!--Time found that if you used display:none on the parent of the element you want to hide, the bg image will not be downloaded-->
<div style="display: none">
<div style="background-image: url(https://avatars0.githubusercontent.com/u/6081537?v=3&s=40)"></div>
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')
@tsq
tsq / qs.html
Created December 27, 2015 12:47
get qs args
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title></title>
</head>
<body>
<script>
// query string arguments
@tsq
tsq / redis.markdown
Created December 14, 2016 11:15 — forked from bdotdub/redis.markdown
Running redis using upstart on Ubuntu

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 / MIT-LICENSE.txt
Created March 6, 2017 13:56 — forked from jgarber/MIT-LICENSE.txt
Responsive video
Copyright (c) 2011 ZURB, http://www.zurb.com/
@tsq
tsq / in_viewport.js
Created June 4, 2017 08:49 — 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().
// 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 / detect-flex.js
Created June 22, 2017 09:21
using js to detect support of flexbox
var d = document.documentElement.style
if (('flexWrap' in d) || ('WebkitFlexWrap' in d) || ('msFlexWrap' in d)){
alert('ok');
}