Skip to content

Instantly share code, notes, and snippets.

View hsquareweb's full-sized avatar

Hassan Elhassan hsquareweb

View GitHub Profile
@hsquareweb
hsquareweb / gist:1990726
Created March 7, 2012 03:31
CSS3: Font-Face
@font-face {
font-family: 'MyWebFont';
src: url('webfont.eot'); /* IE9 Compat Modes */
src: url('webfont.eot?#iefix') format('embedded-opentype'), /* IE6-IE8 */
url('webfont.woff') format('woff'), /* Modern Browsers */
url('webfont.ttf') format('truetype'), /* Safari, Android, iOS */
url('webfont.svg#svgFontName') format('svg'); /* Legacy iOS */
}
.clearfix {
zoom: 1;
&:before, &:after {
content: "";
display: table;
}
&:after {
clear: both;
}
}
@hsquareweb
hsquareweb / gist:1990808
Created March 7, 2012 03:45
CSS: Media Print (H5BP)
@media print {
* {
background: transparent !important;
color: black !important;
text-shadow: none !important;
filter:none !important;
-ms-filter: none !important;
}
a,
@hsquareweb
hsquareweb / gist:1990811
Created March 7, 2012 03:45
CSS: Attribute Substring Selectors
a[href$='.pdf'], a[href$='.PDF'] {
padding-left:20px;
background:transparent url(../img/pdf_icon.png) center left no-repeat;
}
a[href$='.doc'], a[href$='.rtf'], a[href$='.txt'], a[href$='.wps'] {
padding-left: 20px;
background: transparent url(../img/doc_icon.png) center left no-repeat;
}
@hsquareweb
hsquareweb / gist:1990823
Created March 7, 2012 03:50
HTML: Head Meta Tags
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
<meta name="title" content="HsquareWeb by Hassan Elhassan"/>
<meta name="description" content="I am a web designer and front-end web developer based in Arlington, VA, USA. I have been developing websites for the past 4 years, working on various projects based on ideas, themes, illustrations, existing foundations and from scratch."/>
<meta name="keywords" content="Hsquare web, hsquareweb, hsquare, web design, web developer, web design in washington dc, freelance web developer in virginia"/>
<meta name="author" content="Hassan Elhassan"/>
<meta name="robots" content="all"/>
<meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no, maximum-scale=1, minimum-scale=1" />
<meta name="apple-mobile-web-app-capable" content="yes"/>
@hsquareweb
hsquareweb / gist:1990835
Created March 7, 2012 03:54
HTML/JS: Button to Launch New Custom Window
<form action="" method="post">
<input type="button" name="newwin" value="Open New Window" onClick="window.open('http://djakeed.com/listen_now.html','Akeed Radio Player','width=550, height=300,left=0,top=100,toolbar=no,location=no,status=no,menubar=no,scrollbars=no')"/>
</form>
@hsquareweb
hsquareweb / gist:1990845
Created March 7, 2012 03:55
JS: onClick Location/Window Open
onclick="location.href='index.html'"
onclick="window.open('http://www.url.com,'_blank')"
@hsquareweb
hsquareweb / gist:1990855
Created March 7, 2012 03:58
CSS/JS: Table TD Hover For IE
td.hovered {background: #ffdb7f !important; cursor: pointer !important;}
// ********************************************************************
// TABLE TD HOVER FOR IE
// ********************************************************************
if(document.getElementsByTagName) {
(function() {
var className = 'hovered',
pattern = new RegExp('(^|\\s+)' + className + '(\\s+|$)'),
@hsquareweb
hsquareweb / gist:1990862
Last active October 1, 2015 12:18
Scroll To Link
$('a[href^="#"]').on('click', function(event) {
var target = $( $(this).attr('href') );
if( target.length ) {
event.preventDefault();
$('html, body').animate({
scrollTop: target.offset().top
}, 1000);
}
});
@hsquareweb
hsquareweb / gist:1990876
Created March 7, 2012 04:05
WP: Twitter Feed
<!-- twitter -->
<?php
include_once(ABSPATH . WPINC . '/feed.php');
$rss = fetch_feed('https://api.twitter.com/1/statuses/user_timeline.rss?screen_name=DASHendateabuse');
$maxitems = $rss->get_item_quantity(2);
$rss_items = $rss->get_items(0, $maxitems);
?>
<ul>
<?php if ($maxitems == 0) echo '<li>No items.</li>';
else