Skip to content

Instantly share code, notes, and snippets.

View yratof's full-sized avatar
🍊
Eating an orange

Andrew yratof

🍊
Eating an orange
View GitHub Profile
@yratof
yratof / _coupon.scss
Created November 6, 2014 12:15
Woocommerce Coupon
.checkout__coupon{
// Remove that gap
letter-spacing: -0.31em; /* webkit */
letter-spacing: -0.31rem; /* webkit */
*letter-spacing: normal; /* reset IE < 8 */
word-spacing: -0.43em; /* IE < 8 && gecko */
word-spacing: -0.43rem; /* IE < 8 && gecko */
@yratof
yratof / script.js
Created December 7, 2014 01:15
JS - Eye follows mouse
$( document ).on( "mousemove", function( event ) {
var mousePosition = {};
mousePosition.x = event.pageX;
mousePosition.y = event.pageY;
$(".eye").each(function(index,element){
eyePosition = $(this).offset();
angle = Math.atan2(mousePosition.y - eyePosition.top, mousePosition.x - eyePosition.left);
translateX = 10 * Math.cos(angle);
translateY = 10 * Math.sin(angle);
$(this).attr("transform", "translate("+ translateX +" "+ translateY+")");
2px 2px rgba(0, 0, 0, 0.03),
4px 4px rgba(0, 0, 0, 0.027),
6px 6px rgba(0, 0, 0, 0.027),
8px 8px rgba(0, 0, 0, 0.027),
10px 10px rgba(0, 0, 0, 0.024),
12px 12px rgba(0, 0, 0, 0.024),
14px 14px rgba(0, 0, 0, 0.02),
16px 16px rgba(0, 0, 0, 0.02),
18px 18px rgba(0, 0, 0, 0.02),
20px 20px rgba(0, 0, 0, 0.016),
@yratof
yratof / style.scss
Last active August 29, 2015 14:13
Sass Gallery that changes the layout based upon how many images there are
/*
Gallery example
---------------
This will list successive images
in different ways, based on how
many images there are together.
*/
.gallery {
@yratof
yratof / admin-only.php
Last active April 6, 2020 18:29
Helpful functions for wp-members wordpress plugin
/* Stop non-admins from accessing the dashboard.
Instead, they're redirected to a custom page,
which stops them from messing with the website.
This is the url. I've added an extra page to the site_url() */
$goodbye = site_url() .'/video/videos';
function acme_login_redirect( $redirect_to, $request, $user ) {
return ( is_array( $user->roles ) && in_array( 'administrator', $user->roles ) ) ? admin_url() : $goodbye;
}
add_filter( 'login_redirect', 'acme_login_redirect', 10, 3 );
@yratof
yratof / style.scss
Created January 19, 2015 11:21
Loader..
.wrap {
bottom: 0;
left: 0;
margin: auto;
position: absolute;
right: 0;
top: 0
}
.translate {
@yratof
yratof / csv-merge.php
Created January 19, 2015 17:28
Combine CSV rows, but merge differences
<?php /* This changes the CSV into another CSV. But merges duplicated fields. */
$handle = fopen("CLUBEXP.csv", "r");
$row = 0;
$ClubNumberList = array();
while (($data = fgetcsv($handle, 1000, ",")) !== FALSE) {
// ID
$ClubNumber = $data[0];
// Day
@yratof
yratof / functions.php
Last active August 29, 2015 14:13
Picture fill with wordpress – Version 1
<?php
// Custom sizes for Picturefill. You might need to repeat these for every image size you need.
add_image_size( 'size-alpha-small', 320, 175, true );
add_image_size( 'size-alpha-medium', 600, 350, true );
add_image_size( 'size-alpha-large', 1200, 700, true );
add_image_size( 'size-beta-small', 320, 175, true );
add_image_size( 'size-beta-medium', 600, 350, true );
add_image_size( 'size-beta-large', 1200, 700, true );
@yratof
yratof / console.html
Created January 22, 2015 13:29
Three Finger Tap on Android Device to see Modernizr Classes
<script type="text/javascript">/* Three Finger Tap on Android to see <html> Classes. Perfect for Modernizr */if(/android/gi.test(navigator.appVersion)){console={_log:[],log:function(){var e=[];for(var t=0;t<arguments.length;t++){e.push(arguments[t])}this._log.push(e.join(", "))},trace:function(){var e;try{throw new Error}catch(t){e=t.stack}console.log("console.trace()\n"+e.split("\n").slice(2).join(" \n"))},dir:function(e){console.log("Content of "+e);for(var t in e){var n=typeof e[t]==="function"?"function":e[t];console.log(' -"'+t+'" -> "'+n+'"')}},show:function(){alert(this._log.join("\n"));this._log=[]}};window.onerror=function(e,t,n){console.log('ERROR: "'+e+'" at "'+'", line '+n)};window.addEventListener("touchstart",function(e){if(e.touches.length===3){console.log($("html").attr("class"));console.show()}})}</script>
@yratof
yratof / functions.php
Last active August 29, 2015 14:14
Gravity Form Custom Parameters...
/*
Make a hidden field, make it dynamic, give it the value of $parameter.
@usage: gform_field_value_$parameter
1) Ask what month is it.
2) Return a price depending on where the month sits.
These are the parameters that I want to use:
trackadult - Track Adult Prices