Skip to content

Instantly share code, notes, and snippets.

View psynewave's full-sized avatar

Mark Flavin psynewave

View GitHub Profile
@psynewave
psynewave / 0_reuse_code.js
Created June 4, 2014 05:04
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@psynewave
psynewave / isMobile.js
Created June 7, 2014 18:12
Mobile Device JS Detection using Touch Event
function isMobile() {
try{ document.createEvent("TouchEvent"); return true; }
catch(e){ return false; }
}
@psynewave
psynewave / designer.html
Created August 29, 2014 05:24
designer
<link rel="import" href="../core-scaffold/core-scaffold.html">
<link rel="import" href="../core-header-panel/core-header-panel.html">
<link rel="import" href="../core-menu/core-menu.html">
<link rel="import" href="../core-item/core-item.html">
<link rel="import" href="../core-icon-button/core-icon-button.html">
<link rel="import" href="../core-toolbar/core-toolbar.html">
<link rel="import" href="../core-field/core-field.html">
<link rel="import" href="../core-icon/core-icon.html">
<link rel="import" href="../core-input/core-input.html">
<link rel="import" href="../core-icons/core-icons.html">
@psynewave
psynewave / designer.html
Created August 29, 2014 13:57
designer
<link rel="import" href="../core-scaffold/core-scaffold.html">
<link rel="import" href="../core-header-panel/core-header-panel.html">
<link rel="import" href="../core-menu/core-menu.html">
<link rel="import" href="../core-item/core-item.html">
<link rel="import" href="../core-icon-button/core-icon-button.html">
<link rel="import" href="../core-toolbar/core-toolbar.html">
<link rel="import" href="../core-menu/core-submenu.html">
<link rel="import" href="../core-ajax/core-ajax.html">
<polymer-element name="my-element">
@psynewave
psynewave / User_Shortcodes
Created February 4, 2012 09:31
Wordpress User Info Short Code
// display content to logged in users via shortcode
function member_only($atts, $content = null) {
if (is_user_logged_in())
return '<div class="memberContent">' . do_shortcode($content) . '</div>';
return '';
}
add_shortcode('member_only', 'member_only');
// display content to logged out users via shortcode
function non_member($atts, $content = null) {
@psynewave
psynewave / gist:3960513
Created October 26, 2012 18:25
PHP Median Function
function median($numbers){
//loop through each value in the array and if it is a number add it to a new array
foreach ($numbers as $num) {
if(is_numeric($num)){
$num_array[]=$num;
}
}
rsort($num_array); //sort the array for our operation
@psynewave
psynewave / gist:4039711
Created November 8, 2012 15:59
IE Conditional Firebug lite
<!--[if IE]>
<script type="text/javascript" src="https://getfirebug.com/firebug-lite.js"></script>
<![endif]-->
google.load("feeds", "1");
function feed_init() {
}
google.setOnLoadCallback(feed_init);
function getRecentPosts(url,num_max,title,target){
google.feeds.lookupFeed(url, function(result) {
// build the url from whatever data we already have on the page.
var feedsrc = "http://www.bayeast.org/frontpage/feed";
// Load the feeds api from google
google.load("feeds", "1");
// this function is run when google has loaded everything it needs using the setOnLoadCallback below
function GetFeed() {
// define the feed
/*
* jGFeed 1.0 - Google Feed API abstraction plugin for jQuery
*
* Copyright (c) 2009 jQuery HowTo
*
* Licensed under the GPL license:
* http://www.gnu.org/licenses/gpl.html
*
* URL:
* http://jquery-howto.blogspot.com