Skip to content

Instantly share code, notes, and snippets.

View linhyo's full-sized avatar

Dieu Linh linhyo

  • HANU
  • Hanoi, Vietnam
View GitHub Profile
@linhyo
linhyo / detect-mobile.js
Created August 12, 2015 02:36
Detecting Mobile Devices
// Source: http://www.abeautifulsite.net/detecting-mobile-devices-with-javascript/
var isMobile = {
Android: function() {
return navigator.userAgent.match(/Android/i);
},
BlackBerry: function() {
return navigator.userAgent.match(/BlackBerry/i);
},
iOS: function() {
@linhyo
linhyo / hide-ios-keyboard.js
Created July 24, 2015 08:57
Hide the iOS soft keyboard
// Source: http://uihacker.blogspot.com/2011/10/javascript-hide-ios-soft-keyboard.html
var hideKeyboard = function() {
document.activeElement.blur();
var inputs = document.querySelectorAll('input');
for(var i=0; i < inputs.length; i++) {
inputs[i].blur();
}
};
@linhyo
linhyo / twitter-login-popup.js
Created July 21, 2015 03:56
Center Twitter login popup window
// Source: https://www.codeofaninja.com/2011/04/how-to-center-screen-pop-up-window-with.html
function showcontactusform() {
//set the width and height of the
//pop up window in pixels
var width = 500;
var height = 500;
//Get the TOP coordinate by
//getting the 50% of the screen height minus
@linhyo
linhyo / reset.css
Created May 5, 2015 06:39
HTML5 Doctor Reset Stylesheet
/*
html5doctor.com Reset Stylesheet
v1.6.1
Last Updated: 2010-09-17
Author: Richard Clark - http://richclarkdesign.com
Twitter: @rich_clark
*/
html, body, div, span, object, iframe,
h1, h2, h3, h4, h5, h6, p, blockquote, pre,