Skip to content

Instantly share code, notes, and snippets.

View hsquareweb's full-sized avatar

Hassan Elhassan hsquareweb

View GitHub Profile
@hsquareweb
hsquareweb / _extenders.scss
Created November 9, 2015 21:47
Breakpoints
// Breakpoints
@mixin bp($point) {
@if $point == wide {
@media (max-width: $bp-wide) { @content; }
}
@else if $point == full {
@media (max-width: $bp-full) { @content; }
}
@else if $point == landscape {
@media (max-width: $bp-landscape) { @content; }
// create custom selector for external links
$.expr[':'].external = function(obj){
var $this = $(obj);
return !$this.is('[href^="mailto:"]') && !$this.is('[href^="javascript:"]') && (obj.hostname != location.hostname) && ($this.data('target') != "top");
};
// DOM is ready
$(function(){
// apply target="_blank" to each external link on the page
@hsquareweb
hsquareweb / scripts.js
Created December 26, 2013 15:29
Fixing z-index for iframes (changing wmode)
//Fixing z-index problem for iframes
$('iframe').each(function(){
var url = $(this).attr("src");
var char = "?";
if(url.indexOf("?") != -1){
var char = "&";
}
$(this).attr("src",url+char+"wmode=transparent");
});
@hsquareweb
hsquareweb / index.html
Created December 12, 2013 00:13
Collapsable/Toggle Links
<ul class="collapse_list">
<li><a href="#" data-toggle="collapse" data-target="#one">One</a></li>
<li><a href="#" data-toggle="collapse" data-target="#two">Two</a></li>
</ul>
<div class="collapse_content">
<div id="one">
<p>Content for div one</p>
</div>
@hsquareweb
hsquareweb / functions.php
Created December 2, 2013 16:22
Replacing WordPress logo at login
function my_custom_login_logo() {
echo '<style type="text/css">
h1 a { background-image:url('.get_bloginfo('template_directory').'/images/logo.png) !important; }
</style>';
}
add_action('login_head', 'my_custom_login_logo');
@hsquareweb
hsquareweb / framework.js
Created December 2, 2013 16:21
Equal column height
var max_height = 0;
$("div.col").each(function(){
if ($(this).height() > max_height) { max_height = $(this).height(); }
});
$("div.col").height(max_height);
@hsquareweb
hsquareweb / _variables.scss
Created November 29, 2013 23:51
Dynamic List Styles
%list-reset {
padding: 0;
margin: 0;
list-style: none;
}
%list-across {
@extend .clearfix;
> li {
float: left;
@hsquareweb
hsquareweb / _responsive-mixins.scss
Last active December 29, 2015 13:29
Mixins For Responsive Media Queries
// Layout widths
$bp-full: 1200px;
$bp-landscape: 1024px;
$bp-mobile: 767px;
$bp-portrait: 768px;
$bp-wide: 1400px;
$container-width: 1060px;
// Breakpoints
@mixin bp($point) {
@hsquareweb
hsquareweb / framework.js
Created November 1, 2013 22:59
Simple Toggle
$(".element a").click(function () {
$(".elementToggled").toggle();
return false;
}).next().hide();
@hsquareweb
hsquareweb / gist:7032648
Created October 17, 2013 21:38
WP: Query by Post Type (Ex: Branding Area)
<div id="branding">
<?php $loop = new WP_Query(array('post_type' => 'brandingArea', 'orderby'=> 'ASC')); while ( $loop->have_posts() ) : $loop->the_post(); ?>
<div>
<img src="<?php the_field('image'); ?>" alt="" class="slide-background"/>
<div class="slide-content">
<h1><?php the_title(); ?>:</h1>
<p><?php the_field('text'); ?> <a href="<?php the_field('link'); ?>" class="more" title="<?php the_title(); ?>">Learn More</a></p>
</div>
</div>
<?php endwhile; ?>