Skip to content

Instantly share code, notes, and snippets.

View shabith's full-sized avatar

Shabith Thennakone shabith

View GitHub Profile
@shabith
shabith / init-html5.html
Last active December 8, 2022 16:51
HTML5: Starting Template
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width,initial-scale=1">
<title></title>
</head>
<body>
@shabith
shabith / gist:3888174
Created October 14, 2012 10:16
Sublime Text 2 - Useful Shortcuts

Sublime Text 2 – Useful Shortcuts (PC)

Loosely ordered with the commands I use most towards the top. Sublime also offer full documentation.

Editing

Ctrl+C copy current line (if no selection)
Ctrl+X cut current line (if no selection)
Ctrl+⇧+K delete line
Ctrl+↩ insert line after
@shabith
shabith / HTML5 Template (IE7 safe)
Last active May 13, 2016 10:58
HTML5 template with IE7 support
<!DOCTYPE html>
<!--[if lt IE 7]> <html class="no-js lt-ie9 lt-ie8 lt-ie7"> <![endif]-->
<!--[if IE 7]> <html class="no-js lt-ie9 lt-ie8"> <![endif]-->
<!--[if IE 8]> <html class="no-js lt-ie9"> <![endif]-->
<!--[if gt IE 8]><!--> <html class="no-js"> <!--<![endif]-->
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport" content="width=device-width,initial-scale=1">
<meta name="description" content="">
@shabith
shabith / gist:4129070
Created November 22, 2012 02:17
Check for HTML5 support in browser
/**
* Assume we want to check the placeholder HTML5 feature support in input element.
* Credit should go to Daniel Stocks, I found this on his placeholder plugin
* (https://github.com/danielstocks/jQuery-Placeholder/blob/master/jquery.placeholder.js#L71)
*/
var NATIVE_SUPPORT = !!("placeholder" in document.createElement( "input" ));
/**
* Assume we want to check for HTML5 cavas support.
(function() {
var script,
scripts = document.getElementsByTagName('script')[0];
function load(url) {
script = document.createElement('script');
script.async = true;
script.src = url;
scripts.parentNode.insertBefore(script, scripts);
@shabith
shabith / gist:9801530
Last active November 4, 2021 12:51
Regex to extract video ID from Vimeo or Youtube URL
//check for video URL
/* http://lasnv.net/foro/839/Javascript_parsear_URL_de_YouTube */
var video_id_regExp = /^.*((youtu.be\/|vimeo.com\/)|(v\/)|(\/u\/\w\/)|(embed\/)|(watch\?))\??v?=?([^#\&\?]*).*/,
match = url.match(video_id_regExp),
video_id;
if (match&&match[7]){
//valid

Copied from http://code.lancepollard.com/complete-list-of-html-meta-tags/

Basic HTML Meta Tags

<meta charset='UTF-8'>
<meta name='keywords' content='your, tags'>
<meta name='description' content='150 words'>
<meta name='subject' content='your website's subject'>
<meta name='copyright' content='company name'>
@shabith
shabith / README.md
Last active August 29, 2015 14:08
Javascript Scaffold Template

#Javascript Scaffold Template

##Instructions

Replace PN with Project Name Abbrivation. Make it Simple and CAP, and make sure it doesn't be longer than 3 Characters.

Replace page-name with Page Name (Obviously!). Make it simple and understandable.

##PhpStrom/WebStrom Template

Note: Some of these shortcuts have been remapped for my own convenience (Preferences->Keymap). These are Mac shortcuts, just use the Windows/Linux equivalent of the Cmd/Option/Ctrl/Del keys.

####Search, Go to, Navigation ####

Cmd + P - Search file

Cmd + Shift + O - Search everywhere

(I swapped the above two recently because I use Cmd + P to search for files most of the time).

@shabith
shabith / .htaccess
Last active August 29, 2015 14:24 — forked from ScottPhillips/.htaccess
#301 Redirects for .htaccess
#Redirect a single page:
Redirect 301 /pagename.php http://www.domain.com/pagename.html
#Redirect an entire site:
Redirect 301 / http://www.domain.com/
#Redirect an entire site to a sub folder
Redirect 301 / http://www.domain.com/subfolder/