Skip to main content

Tedshd's Dev note

CSS - web font

# CSS - web font Use our font Put your font file on your server. Default font can’t cross domain used. Suggest use OTF or TTF format. @font-face { font-family: playstation; src: url(TRIIYP.otf); } @font-face { font-family: sony; src: url(sony.TTF); } ## Fonts SONY’s Logo Font Download Free ps4 fonts - FontSpace ## Demo ps4 Refer - CSS3 Web Fonts ...

gulp.js - Concatenate File When Gulp Watch

# gulp.js - Concatenate File When Gulp Watch ## package.json { "name": "gulp", "version": "3.8.7", "devDependencies": { "gulp": "^3.9.0", "gulp-concat": "^2.6.0", "gulp-watch": "^4.3.4" } } ## gulpfile.js var gulp = require('gulp'), watch = require('gulp-watch'), concat = require('gulp-concat'); var js; gulp.task('concat', function (cb) { var options = {}; watch('dev/*.js', options, function (e) { // console.log('e:'+JSON.stringify(e)); // console.log('\n'); console.log(new Date() + ' -- ' + e.history[0].replace(e.base, '')); js = e.history[0].replace(e.base, ''); gulp. ...

Apache - Apache Command Line on Mac / Ubuntu

# Apache - Apache Command Line on Mac / Ubuntu ## Mac sudo apachectl start sudo apachectl restart sudo apachectl status sudo apachectl stop ## Ubuntu sudo /etc/init.d/apache2 start sudo /etc/init.d/apache2 restart sudo /etc/init.d/apache2 status sudo /etc/init.d/apache2 stop sudo service apache2 start sudo service apache2 restart sudo service apache2 status sudo service apache2 stop Refer - Ubuntu Linux: Start / Restart / Stop Apache Web Server ...

JavaScript - scrollTop

# JavaScript - scrollTop ## scrollTop Element.scrollTop - Web API Interfaces | MDN ## Issue in firefox Normal element.scrollTop = intValue; But when I use document.body.scrollTop = 0; It doesn’t work in firefox. Solution document.documentElement.scrollTop = 0; // for firefox Refer - document.body.scrollTop vs document.documentElement.scrollTop ...

CSS3 - object-fit

# CSS3 - object-fit We can use CSS3 property object-fit handle image show area and fit it. But only IE no support. Example See the Pen img object-fit by Ted (@tedshd) on CodePen. Refer - object-fit Refer - object-fit ...

JavaScript - insertBefore & insertAfter

# JavaScript - insertBefore & insertAfter ## insertBefore This is native JavaScript api var insertedElement = parentElement.insertBefore(newElement, referenceElement); var vDom = document.createElement('div'), dom = document.querySelector('#list'); dom.insertBefore(vDom, dom.childNodes[1]); // or var vDom = document.createElement('div'), dom = document.querySelector('#target'); dom.parentNode.insertBefore(vDom, dom); Refer - Node.insertBefore() ## insertAfter JavaScript doesn’t have any api handle insert DOM after reference DOM We can use this way function insertAfter(newNode, referenceNode) { referenceNode.parentNode.insertBefore(newNode, referenceNode.nextSibling); } Refer - How to do insert After() in JavaScript without using a library? ...

JavaScript - Dynamic Load script || JSONP Callback

# JavaScript - Dynamic Load script || JSONP Callback ## Intro Sometimes we need dynamic load script or handle jsonp callback And we need handle script onload or jsonp callback onload or something error ## How to do? Use onload, onerror method ## Code if (typeof UTIL == 'undefined' || !UTIL) { var UTIL = {}; } UTIL.createEl = { get: function(sTag, oAttr, handleOnLoad, handleError) { var el = document. ...

Docker - Mac research log

# Docker - Mac research log Install by Mac ## Register Docker Hub Docker Hub ## Use Kitematic kitematic ## Install Ubuntu Search ubuntu on docker hub Run command docker pull ubuntu ### Use docker images docker images REPOSITORY TAG IMAGE ID CREATED VIRTUAL SIZE ubuntu latest 07f8e8c5e660 3 weeks ago 188.3 MB ### build dockerfile docker build . -t ubuntu_dev:16.04 -f local.Dockerfile ### run container docker run -t -i ubuntu /bin/bash ...