Skip to content

Instantly share code, notes, and snippets.

View jimmy89Li's full-sized avatar

Li jimmy89Li

View GitHub Profile
@jimmy89Li
jimmy89Li / redirect.html
Created February 23, 2017 13:20
Redirect website to another domain
<!DOCTYPE html>
<html>
<head>
<script type="text/javascript">
window.location="http://liviusimion.com";
</script>
</head>
<body>
@jimmy89Li
jimmy89Li / index.html
Created March 3, 2017 10:59
css new style for radio buttons
<label for="accessible">
<input type="radio" value="accessible" name="quality" id="accessible"> <span>accessible</span>
</label>
<label for="pretty">
<input type="radio" value="pretty" name="quality" id="pretty"> <span>pretty</span>
</label>
<label for="accessible-and-pretty">
<input type="radio" value="pretty" name="quality" id="accessible-and-pretty" checked> <span>accessible and pretty</span>
<!--HTML-->
<div class="header">
<div class="headerBg"></div>
</div>
<!--STYLE-->
<style>
.headerBg {
background-image: url(../img/headerBg.png);
@jimmy89Li
jimmy89Li / functions.php
Created March 29, 2017 14:38
Custom button with custom styles - WordPress editor
<?php
// Add custom button for styles
function customStylesButton($buttons) {
array_unshift($buttons, 'styleselect');
return $buttons;
}
add_filter('mce_buttons_2', 'customStylesButton');
//Add custom styles to the WordPress editor
function my_custom_styles( $init_array ) {
@jimmy89Li
jimmy89Li / resizer.js
Created March 30, 2017 09:58
jQuery resize trigger
$( window ).resize(function() {
...
});
$(function(){
$(window).trigger('resize');
});
@jimmy89Li
jimmy89Li / halfWindowSize.js
Created March 30, 2017 10:00
Resize div based on windows size - half of window size or 560px of smaller then 560x2
var h = (($(window).height()/2)<560) ? 560 : $(window).height()/2;
$('.header').height(h);
@jimmy89Li
jimmy89Li / halfDivBottom.js
Created March 30, 2017 10:02
Margin bottom -half of div size
var subscribeOffset = ($('.subscribe').outerHeight()/2)*-1;
$('.subscribe').css('bottom',subscribeOffset+'px');
@jimmy89Li
jimmy89Li / divHeight.js
Created March 30, 2017 10:03
Div height based on other div height
var secondTop = (($(window).width())<660) ? ($('.subscribe').outerHeight()/2) : 160;
$('.second .topPattern').height(secondTop);
@jimmy89Li
jimmy89Li / selectUpdatedLastHour.sql
Created May 10, 2017 09:11
Select from database where updatedDate was done in the last 60 minutes
SELECT * FROM wp_terms WHERE updatedDate > (now() - interval 60 minute);
@jimmy89Li
jimmy89Li / categoryUpdatedDate.php
Created May 10, 2017 10:45
Update updatedDate for last updated Category
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
$wpdb->query("UPDATE wp_terms SET updatedDate=NOW() WHERE term_id='".$_POST['tag_ID']."'");
}