- 960 Grid System - An effort to streamline web development workflow by providing commonly used dimensions, based on a width of 960 pixels. There are two variants: 12 and 16 columns, which can be used separately or in tandem.
- Compass - Open source CSS Authoring Framework.
- Bootstrap - Sleek, intuitive, and powerful mobile first front-end framework for faster and easier web development.
- Font Awesome - The iconic font designed for Bootstrap.
- Zurb Foundation - Framework for writing responsive web sites.
- SASS - CSS extension language which allows variables, mixins and rules nesting.
- Skeleton - Boilerplate for responsive, mobile-friendly development.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Calculate percentage of two numbers | |
$user1 = 100; | |
$user2 = 50; | |
echo ($user2 / $user1) * 100; //output: 50 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
usage: | |
call function: centerThings(); | |
add class: "center-vert" | |
add offset (optional): data-center-offset="-3" | |
example: <div class="center-vert" data-center-offset="-3">text</div> | |
demo: http://jsfiddle.net/adamculpepper/kns0osky | |
*/ | |
function centerThings() { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// demo: http://jsfiddle.net/adamculpepper/mvcjbwbv | |
$(window).scroll(makeSticky).trigger("scroll"); | |
$(window).load(function () { | |
$(".sticky-element").each(function () { | |
var el = $(this); | |
if (!el.attr("data-offset-top")) { | |
el.attr("data-offset-top", el.offset().top); | |
el.attr("data-offset-left", el.offset().left); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* OnTime Loader */ | |
.yui3-cardgrid-loading {background:rgba(255, 0, 255, 0.5) url('data:image/gif;base64,R0lGODlhKQF4AMMJAAICAgKa/v6aAv7+Av4CApqamv7OmjL+AmYy/v4C/v6a+f7+/v4ymgAAAAAAAAAAACH/C05FVFNDQVBFMi4wAwEAAAAh+QQJBgANACwAAAAAKQF4AAAE/7DJSau9OOvNu/9g2ABkaZ5oqq5s676pKM90bd94PsJ87/8+nXBILBprwKRy2Ts6n9DojUmtWqXYrFZr7XqD27B4PP2azzHyh8Buu9/wuHxOINPv+PjJwO/7/4CBgoOEhYaHgSdqGnmNjm52j5Jwe4iWl5iZmIqLGJOfc5Ggk5WapqeoiJydFqOubaKvjaWptbapq6wUsq6xvHe0t8LDh7lQv8jJysttKJgK0NHS09TV1tfY2dabxkPM3+Dhec6X2ubn6OnS3CZO4u/w4uSW6vX29+wl7vH8/bzziO4JHJgtH4l9/hIqdATwEMGHEKEZBIBwocWLbxoaishR4MSKGP9DLtT4pyM1BihTakuJ0mQhFCBFyuRH0o/JaSxbZsvpkhDMIzOD9qvZ56a0nAxWsuw56KcRoVDfEeVjNBpSpSo7vuwmJKrXb1MNVIV2dedSrT656vjKNlnYsQrKYuOJtqnaHJIE6N3Lt6/fv4ADC7gouLBhAQ2xZoXL+Nofp0XyHp5MeS/hypgTmz3buPO0x3dxSMZMOvDl0oc1z6XrubUC0O2APkJNu+/p2oFVX5PrujNsfbId4cZ9e7hf3dZ492b8++AR49CjS58OGHk15cvHNqf4nLr37+ArW89+rcXmxY79QJbQIkT49/DjIw5G/pz51ZzT91m/Y4V7+QAGaNz/ePVRc99urOnHB3/tgSDggxBmRl+B2RyYXILbqNdNgx9E6OGH1U1IYXksnKcTNttZwKEHILbYIoHkoVDAjDTWWAAKBG0no4028leBi0B |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function detectFrame() { | |
if (window.frameElement) { | |
// in frame | |
alert('framed: YES'); | |
$('body').addClass('framed'); | |
} else { | |
// not in frame | |
alert('framed: NO'); | |
$('body').removeClass('framed'); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function stripTrailingSlash(str) { | |
if(str.substr(-1) === '/') { | |
return str.substr(0, str.length - 1); | |
} | |
return str; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function cutUrl(str, num) { | |
var matched = str.match("([^/]*\/){" + num + "}"); | |
return matched ? matched[0] : str; /* or null */ | |
} | |
//usage | |
//var url = location.pathname; | |
var url = "http://domain.com.com/page/subpage/fsdf/dsfg/dgff/gsd/fsdfsg/sddfsdf/gds/fsdf/"; | |
console.log( cutUrl(url, 4) ); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
print("<pre>" . print_r($array, true) . "</pre>"); | |
//https://stackoverflow.com/questions/4414623/loop-through-an-array-php | |
//Using foreach loop without key | |
foreach($array as $item) { | |
echo $item['filename']; | |
echo $item['filepath']; | |
// to know what's in $item | |
echo '<pre>'; var_dump($item); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
get_category($category_id)->count //items in category | |
//just posts in category | |
$query = new WP_Query( array('posts_per_page' => -1, 'category__in' => $category) ); | |
$count = $query->post_count; | |
echo 'count: ' . $count; | |
INSIDE LOOP |