Skip to content

Instantly share code, notes, and snippets.

View overwine's full-sized avatar

John M. Overwine overwine

View GitHub Profile
class Person
#have a first_name and last_name attribute with public accessors
#attr_accessor
public
attr_accessor :first_name, :last_name
#have a class attribute called `people` that holds an array of objects
@@people = []
#have an `initialize` method to initialize each instance
@overwine
overwine / main.js
Created January 6, 2016 15:51
Resizing vimeo on load
$(window).bind("load", function() {
// Vimeo and YouTube Embed Resizing
// Find all YouTube videos
var $allVideos = $("iframe[src*='//player.vimeo.com'], iframe[src*='//www.youtube.com']"),
// The element that is fluid width
$fluidEl = $(".content-body");
// Figure out and save aspect ratio for each video
$allVideos.each(function() {
@overwine
overwine / newbs.js
Last active August 29, 2015 14:26
Scroll up and scroll down detection + animation
var lastScrollTop;
//console.log(lastScrollTop);
$(window).scroll(function(event){
$('.top-filter').stop();
var currentScrollTop = $(window).scrollTop();
if (currentScrollTop > lastScrollTop){
$('.top-filter').animate({
top: "-20px",
}, 1000);
@overwine
overwine / navigation.js
Created March 12, 2015 18:02
JERVASCRERPT
//scroll to navigation http://webdesign.tutsplus.com/tutorials/complete-websites/create-a-parallax-scrolling-website-using-stellar-js/
jQuery(document).ready(function ($) {
//initialise Stellar.js
$(window).stellar();
//Cache some variables
var links = $('.narrarive.navigation li');
var slide = $('.page-section');
var button = $('.button');
@overwine
overwine / fetch_locations.php
Created February 26, 2015 22:00
Stuff and things Lorie.
<?php
function findStores() {
//creating array of data to be posted
$post_data['item'] = $_POST['locateitem'];
$post_data['radius'] = $_POST['locateradius'];
$post_data['ip'] = $ip;
//traverse array and prepare data for posting
foreach ( $post_data as $key => $value) {
@overwine
overwine / theworst.php
Created February 26, 2015 20:31
Terrible idea stuff.
<!doctype html>
<?php
/*if ($_SERVER['REQUEST_METHOD'] == 'POST') {
if(!empty($_POST['locatezip'])){
$_POST['zip'] = $_POST['locatezip'];
$_POST['radius'] = $_POST['locateradius'];
$_POST['item'] = $_POST['locateitem'];
}
}*/
if (!empty($_SERVER['HTTP_CLIENT_IP']))
<?php
/**
* WooCommerce Tax Settings
*
* @author WooThemes
* @category Admin
* @package WooCommerce/Admin
* @version 2.1.0
*/
@overwine
overwine / .htaccess
Created November 26, 2013 01:28
.htaccess making any www url go to the homepage
RewriteEngine On
# Ugh wordpress - wordpress apparently doesn't like it if you refer to the
# site interchangably between www.domain.com and domain.com, so rewrite
# the non-www version to the www version here to avoid problems. If we don't
# do this, going to domain.com/anything-at-all will redirect to the root of
# www.domain.com, which is not helpful.
# NOTE: This is a 302 redirect, not a 301, as at some point we might want to
# make the non-www site the "canonical" one
# FIX - redirets realmswork.com as well
function post_save($entry, $form) {
$post_url = "http://www.lasikplus.com/ischedule/action/contactRequest.lp";
function format_phone($phone) {
var_dump($phone);
$phone = preg_replace("/[^0-9]/", "", $phone);
$phone = preg_replace("/([0-9]{3})([0-9]{3})([0-9]{4})/", "$1 $2 $3", $phone);
var_dump($phone);
return explode(' ', $phone);
@overwine
overwine / form-shenanigans.php
Created August 23, 2013 15:18
Herpa, derpa.
$phone = $entry["5"];
function format_phone($phone) {
$phone = preg_replace("/[^0-9]/", "", $phone);
if (strlen($phone) == 7) {
return preg_replace("/([0-9]{3})([0-9]{4})/", "$2 $3", $phone);
} elseif (strlen($phone) == 10) {
return preg_replace("/([0-9]{3})([0-9]{3})([0-9]{4})/", "$1 $2 $3", $phone);