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 / _base.scss
Last active August 29, 2015 14:01
:Target for Modules / Lightboxes
// Vertical Mixin for those who don't have it
@mixin vertical-align {
position: absolute; //relative
top: 50%;
-webkit-transform: translateY(-50%);
-moz-transform: translateY(-50%);
-o-transform: translateY(-50%);
-ms-transform: translateY(-50%);
transform: translateY(-50%);
@yratof
yratof / _base.scss
Created May 22, 2014 14:32
WooCommerce Checkout for Mobile
@media only screen and (max-width: 760px) {
.woocommerce-cart #content .woocommerce table.shop_table td,
.woocommerce-cart #content .woocommerce-page table.shop_table td,
.woocommerce-checkout #content .woocommerce table.shop_table td,
.woocommerce-checkout #content .woocommerce-page table.shop_table td {
padding: 3px 0;
border-top: 0;
}
@yratof
yratof / .htaccess
Created June 5, 2014 23:00
Ultimate Pagespeed Module htaccess responsive images
#########################################################
#----------------- P A G E S P E E D -------------------#
#########################################################
# Our server has PageSpeed installed on it. Which makes our life optimised. Seriously optimised too.
# I've got a bunch of things you can add to your site below. Comment out what you don't want.
# I've tested out a bunch of this stuff, if anything doesn't work, flag it up and let me know asap.
# Turn on PageSpeed + It's Candy
@yratof
yratof / .htaccess
Created June 6, 2014 21:26
Block semalt.com so it doesn't mess up your Google Analytics
SetEnvIfNoCase Referer semalt.com spammer=yes
Order allow,deny
Allow from all
Deny from env=spammer
@yratof
yratof / loop.php
Last active August 29, 2015 14:03
Get Barley and Custom Fields with Types
<?php
// Using a custom field called wpcf-home-heading created by types.
// The entered value of this is: Plastic Cards to get you noticed
<?php
$field = types_render_field("home-heading", array());
if ( function_exists( 'barley_wrapper' )) {
echo barley_wrapper('wp_custom_field' , $field, ($field));
@yratof
yratof / gist:4f312ae162f49876959c
Last active August 29, 2015 14:03
Barley Custom Field
function barley_field($field_name){
$key_values = get_post_custom_values( $field_name );
foreach ( $key_values as $key => $value ) {
if ( function_exists( 'barley_wrapper' )) {
echo barley_wrapper('wp_custom_field', $value , $field_name);
} else {
echo $value;
}
}
}
@yratof
yratof / tea.py
Last active August 29, 2015 14:04
TeaCounter_pi
import RPi.GPIO as GPIO
import time
GPIO.setmode(GPIO.BCM)
PIR_PIN = 7
GPIO.setup(PIR_PIN, GPIO.IN)
try:
print ("Brew Counter (CTRL + C to exit)")
time.sleep(2)
@yratof
yratof / tea.py
Last active August 29, 2015 14:04
Tea Counter using UbiDots
from ubidots import ApiClient
import RPi.GPIO as GPIO
import time
GPIO.setmode(GPIO.BCM)
GPIO.setup(7, GPIO.IN)
try:
api = ApiClient("d655b3fd31aa3267687ae30039ed00fec16a072e")
people = api.get_variable("53d82d7676254232ac805991")
@yratof
yratof / functions.php
Created July 30, 2014 12:19
Limit Wordpress Filesize upload.
@ini_set( ‘upload_max_size’ , ’3M’ );
@ini_set( ‘post_max_size’, ’3M’);
@ini_set( ‘max_execution_time’, ’1000′ );
@yratof
yratof / scripts.js
Created July 31, 2014 15:25
Resize text according to the width of the area
<script type="text/javascript">
// use strict
jQuery(document).ready(function ($) {
function fontFollow(shit, poop){
// Pick the width of something that you want to match.
// This is an image that we're matching up here.
var ratioWidth = $(".ratio_element").outerWidth();
// Divide the width into 100 tiny bits