Skip to content

Instantly share code, notes, and snippets.

View moskowite's full-sized avatar

Tyler Moskowite moskowite

View GitHub Profile
<script>
function startScrolling(){
var getInt = setInterval(function js_spinner(){
if(typeof js_spinner_bottom === 'undefined'){
js_spinner_bottom = 0;
}
js_spinner_bottom += 300;
if(js_spinner_bottom > 1200){
js_spinner_bottom = 0;
// Bind the mouse enter and mouse leave events using
// the convenience method, hover().
$( "#outer-hover" ).hover(
function(){
console.log( "mouseEnter" );
},
function(){
console.log( "mouseLeave" );
}
);
<?php wp_nav_menu( array('menu' => 'Top Bar', 'container' => '','container_class' => 'menu-{menu slug}-container navi','items_wrap' => '%3$s', 'fallback_cb' => false )); ?>
<?php wp_nav_menu( array('menu' => 'Top Bar', 'container' => '','container_class' => 'menu-{menu slug}-container navi','items_wrap' => '%3$s', 'fallback_cb' => false )); ?>
<?php wp_nav_menu(
array('menu' => 'Top Bar', 'container' => '','container_class' => 'menu-{menu slug}-container navi','items_wrap' => '%3$s', 'fallback_cb' => false )
);
?>
// 60 seconds * 60 minutes * 24 hours = 1 day refresh
$refreshInterval = 60*60*24;
$input = range(1,30);
$arr = array_rand($input, 4);
if ( false === ( $featured_products = get_transient( 'featured_products' ) ) ) {
// It wasn't there, so regenerate the data and save the transient
$request_url = 'http://makershed.com/net/webservice.aspx?api_name=generic\featured_products';
function js_featured_products() {
$input = range(1,30);
$arr = array_rand($input, 4);
// for debugging
// delete_transient( 'xml_featured_products' );
if ( false === ( $xml_featured_products = get_transient( 'xml_featured_products' ) ) ) {
// It wasn't there, so regenerate the data and save the transient
@moskowite
moskowite / gist:1628811
Created January 17, 2012 20:54
SOPA PHP conditional
<?php
date_default_timezone_set('America/Los_Angeles');
$current_time = date('G:i');
$start_time = '08:00';
$end_time = '20:00';
if( $current_time >= $start_time && $current_time <= $end_time )
echo 'SOPA';
else
echo 'not SOPA'
<?php
/*
* Plugin Name: Sopa Redirection
* Plugin URI: http://oreilly.com/blackout.html
* Description: Redirect the blog to oreilly blackout page.
* Author: whyisjake, tmoskowite
* Version: 1.0
* Author URI: oreilly.com
*/
<?php
function __update_post_meta( $post_id, $field_name, $value = '' ) {
if ( empty( $value ) OR ! $value ) {
delete_post_meta( $post_id, $field_name );
} elseif ( ! get_post_meta( $post_id, $field_name ) ) {
add_post_meta( $post_id, $field_name, $value );
} else {
update_post_meta( $post_id, $field_name, $value );
}