Skip to content

Instantly share code, notes, and snippets.

View abachuk's full-sized avatar
✍️
dev manager by day, writing code at night

Alex Bachuk abachuk

✍️
dev manager by day, writing code at night
View GitHub Profile
@abachuk
abachuk / jqm-hacks
Created July 31, 2012 15:04
jQuery Mobile hacks and fixes
/********** iOS rotation zoom fix **********/
var viewport = $('meta[name="viewport"]');
var nua = navigator.userAgent;
if ((nua.match(/iPad/i)) || (nua.match(/iPhone/i)) || (nua.match(/iPod/i))) {
viewport.attr('content', 'width=device-width, minimum-scale=1.0, maximum-scale=1.0');
$('body')[0].addEventListener("gesturestart", gestureStart, false);
}
function gestureStart() {
@abachuk
abachuk / Custom Post type meta box for WordPress
Created July 28, 2012 22:58
Custom Post type meta box for WordPress (extension to CPT)
/******* RELATED PAGES METABOX *********/
add_action( 'cmb_render_select_post', 'rrh_cmb_render_select_post', 10, 2 );
function rrh_cmb_render_select_post( $field, $meta ) {
global $posts;
$posts = get_posts( array( 'post_type' => 'page', 'posts_per_page' => -1 ));
echo '<select name="', $field['id'], '" id="', $field['id'], '">';
foreach ($posts as $option) {
echo '<option value="', $option->ID, '"', $meta == $option->ID ? ' selected="selected"' : '', '>', $option->post_title, '</option>';
}
echo '</select>';
@abachuk
abachuk / sass mixins
Created July 15, 2012 20:15
SASS Mixins
@mixin box-shadow($shadow) {
-moz-box-shadow: $shadow;
-webkit-box-shadow: $shadow;
box-shadow: $shadow
}
@mixin transition($trans) {
-webkit-transition:$trans;
-moz-transition:$trans;
-o-transition:$trans;
<?php class slider_widget extends WP_Widget {
function slider_widget() {
$widget_options = array(
'classname' => 'slider',
'description' => 'add promo slider'
);
parent::WP_Widget(false, 'Promotional Slider', $widget_options);
@abachuk
abachuk / gist:2373381
Created April 13, 2012 03:23
WP example 1
<?php
/**
* Template Name: Business Rankings
* @package WordPress
*/
get_header();
?>
<aside class="right-sidebar">
<ul class="widgets">