Skip to content

Instantly share code, notes, and snippets.

View MikeRogers0's full-sized avatar
🚂

Mike Rogers MikeRogers0

🚂
View GitHub Profile
@MikeRogers0
MikeRogers0 / gist:1751763
Created February 6, 2012 12:02 — forked from westonruter/gist:311373
jQuery fallback implementation of HTML5 placeholder attribute
if(!jQuery('<input PLACEHOLDER="1" />')[0].placeholder){ //Uppercase attr for IE
jQuery(':input[placeholder]').each(function(){
var $this = $(this);
if(!$this.val()){
$this.val($this.attr('placeholder'));
$this.addClass('input-placeholder');
}
}).live('focus', function(e){
var $this = $(this);
if($this.hasClass('input-placeholder')){
$query = '
CREATE TABLE products (
product_id int not null auto_increment PRIMARY KEY,
product_name varchar(100),
description varchar(200),
photo_url varchar(100),
price decimal(4,2),
stock_level decimal(3,0)
);
';
$('form.fileEdit input[type="submit"]').on('click', function(e) {
e.preventDefault();
var _$thisElem = $(this);
$.getJSON(ADMIN_URL+'filemanager/editfile',
_$thisElem.parent('form').serialize(),
function(data) {
alert(data);
getFiles({clearout:true});
}
);
@MikeRogers0
MikeRogers0 / scopes.php
Last active November 19, 2018 01:25 — forked from tomoakley/PHP Variable Scope with Wordpress shortcode attributes
PHP Variable Scope with Wordpress shortcode attributes
<?php
// I have a function, embedVine(), which is a Wordpress shortcode. It uses one attribute, $id which I've assigned to $vine_id to avoid confusion ($post_id etc). This shortcode takes the ID (Vine IDs are the ending of the Vine URL, e.g http://vine.co/v/hx9LlrZxdqV, the id = hx9LlrZxdqV) and embed's the Vine within a Wordpress post. The shortcode markup is [vine id='...'].
$vine_id = false;
global $vine_id;
function embedVine($atts) {
global $vine_id;
extract(shortcode_atts(array(
"id" => ''
#!/usr/bin/env sh
##
# Make your Mac feel like home...
# Shoutout to @dtsn for being generally awesome and getting me started.
#
# install it:
# curl -sL https://gist.github.com/BenNunney/7219538/raw/f9b933cca93b67dd63a2d8b1eeebb69e87dc9591/feels-like-home.sh | sh
#