Skip to content

Instantly share code, notes, and snippets.

View noyb34's full-sized avatar
🎯
Focusing

Patrick R noyb34

🎯
Focusing
  • Global
View GitHub Profile
@noyb34
noyb34 / color_customizer.php
Created April 16, 2013 03:51
This snippet customize the colors of WP theme
<?php
// WORDPRESS 3.4 THEME OPTIONS
add_action( 'customize_register', 'hg_customize_register' );
function hg_customize_register($wp_customize)
{
$colors = array();
$colors[] = array( 'slug'=>'content_bg_color', 'default' => '#ffffff', 'label' => __( 'Content Background Color', 'YOUR_THEME_NAME' ) );
$colors[] = array( 'slug'=>'content_text_color', 'default' => '#000000', 'label' => __( 'Content Text Color', 'YOUR_THEME_NAME' ) );
foreach($colors as $color)
@noyb34
noyb34 / CANONICALIZATION SNIPPETS
Created April 17, 2013 00:54
Wordpress Cannonical Snippets
# CANONICALIZATION SNIPPETS
<IfModule mod_alias.c>
# redirect empty tag requests to homepage
RedirectMatch 301 ^/tag/?$ http://example.com/
# redirect empty page requests to homepage
RedirectMatch 301 ^/page/?$ http://example.com/
# redirect empty search requests to homepage
RedirectMatch 301 ^/search/?$ http://example.com/
@noyb34
noyb34 / css.php
Created April 17, 2013 01:00
This PHP code combine all my css files into one therefore reducing the number of http request to the server
<?php // combine all CSS files
header('Content-type: text/css');
$path_to_css = '/css'; // edit path to css directory
function get_files($dir = '.', $sort = 0) {
$files = scandir($dir, $sort);
$files = array_diff($files, array('.', '..'));
return $files;
}
$files = get_files($path_to_css, 1);
foreach($files as $file) {
@noyb34
noyb34 / BroF
Created April 17, 2013 01:26
This function snippet helps break out frames, so your pages are served only from the original domain not some douchebag's Google adsense site
// Break Out of Frames for WordPress
function break_out_of_frames() {
if (!is_preview()) {
echo "\n<script type=\"text/javascript\">";
echo "\n<!--";
echo "\nif (parent.frames.length > 0) { parent.location.href = location.href; }";
echo "\n-->";
echo "\n</script>\n\n";
}
}
// ==================================================================
// Flexbox
//
// Implementation based on Chris Coyier's article:
// Using Flexbox: Mixing Old and New for the Best Browser Support || http://css-tricks.com/using-flexbox/
// ==================================================================
// Flexbox Context (applied to container element of flex items)
@mixin flex-display {
@include experimental-value(display, box, -moz, -webkit, not -o, -ms, not -khtml, official); // Old
@noyb34
noyb34 / index.html
Created July 27, 2013 18:02
A CodePen by Brady Sammons. CSS3 Card Deck Drop Down - This is a UI concept i have seen before but i felt there was a few things that could be done different. Ao here is my version of a Card Deck style dropdown, using CSS3 transitions and jQuery.
<link href="//netdna.bootstrapcdn.com/font-awesome/3.2.1/css/font-awesome.css" rel="stylesheet">
<div id="wrapper">
<h1><i class='icon-sort-by-attributes'></i> CSS3 <span>Card Deck Drop Down</span></h1>
<div class="card-drop">
<a class='toggle' href="#">
<i class='icon-suitcase'></i>
<span class='label-active'>Everyting</span>
</a>
<ul>
@noyb34
noyb34 / index.html
Created July 27, 2013 18:02
A CodePen by Brady Sammons. CSS3 Card Deck Drop Down - This is a UI concept i have seen before but i felt there was a few things that could be done different. Ao here is my version of a Card Deck style dropdown, using CSS3 transitions and jQuery.
<link href="//netdna.bootstrapcdn.com/font-awesome/3.2.1/css/font-awesome.css" rel="stylesheet">
<div id="wrapper">
<h1><i class='icon-sort-by-attributes'></i> CSS3 <span>Card Deck Drop Down</span></h1>
<div class="card-drop">
<a class='toggle' href="#">
<i class='icon-suitcase'></i>
<span class='label-active'>Everyting</span>
</a>
<ul>
@noyb34
noyb34 / index.html
Created July 27, 2013 18:04
A CodePen by Erick Ramirez. Text Shadow Compilation - 20-something unique examples of text shadows in CSS, from the beautiful to the bizarre to the "do you still use comic sans, too?" type stuff.
<span contenteditable>
<p>This is a compilation of different usages of text-shadow, and hopefully captures most of them. If something's missing, feel free to message me or just fork it and add it yourself. Also, everything here is contenteditable so feel free to mess around with that.<br/>
NOTE: includes ugly ones too.</p>
<h1 class="basic">Basic</h1>
<h1 class="letterpress">LetterPress</h1>
<h1 class="hard-shadow">Hard Shadow</h1>
<h1 class="vintage"><span>Vintage</span></h1>
<h1 class="distant">Distant</h1>
<h1 class="jumbled">Jumbled</h1>
<h1 class="large-blur">Large Blur</h1>
@noyb34
noyb34 / index.html
Created July 27, 2013 18:30
A CodePen by Hugo Darby-Brown. Social-Media Card
<header>
<span class="entypo-dot-3 right"></span>
<div class="social">
<span class="entypo-facebook"></span>
<span class="entypo-twitter"></span>
<span class="entypo-gplus"></span>
<span class="entypo-tumblr"></span>
</div>
@noyb34
noyb34 / index.html
Created July 27, 2013 18:44
A CodePen by Thibaut. Tabbed Widget - By [CSSFlow](http://www.cssflow.com): free UI elements and widgets coded with HTML5, CSS3, and Sass. View the original article and download the Sass source at: [cssflow.com/snippets/tabbed-widget](http://www.cssflow.com/snippets/tabbed-widget) Original PSD by [Aaron Sananes](http://dribbble.com/shots/961963-…
<div class="widget">
<ol class="widget-list" id="managers">
<li>
<a class="widget-list-link">
<img src="http://www.gravatar.com/avatar/47?f=y&amp;s=64&amp;d=identicon">
Manager #1 <span>481 followers</span>
</a>
</li>
<li>
<a class="widget-list-link">