Skip to content

Instantly share code, notes, and snippets.

View valeriu's full-sized avatar
🎯
Focusing

Valeriu Tihai valeriu

🎯
Focusing
View GitHub Profile
'use strict';
var gulp = require('gulp'),
watch = require('gulp-watch'),
prefixer = require('gulp-autoprefixer'),
uglify = require('gulp-uglify'),
sass = require('gulp-sass'),
sourcemaps = require('gulp-sourcemaps'),
rigger = require('gulp-rigger'),
cssmin = require('gulp-minify-css'),
@trslater
trslater / custom-registration.php
Last active May 12, 2020 13:47
Custom Registration Plugin
<?php
/*
Plugin Name: Custom Registration
Description: Updates user rating based on number of posts.
Version: 1.1
Author: Tristan Slater w/ Agbonghama Collins
Author URI: http://kanso.ca
*/
@bryceadams
bryceadams / gist:9d469b7c297db5aebad9
Last active April 14, 2017 10:16
Restricts WooCommerce local pickup for minimum order amount
/**
* Restricts WooCommerce local pickup for minimum order amount
* Change $min_amount to the integer amount you want to set as the minimum.
*/
add_filter( 'woocommerce_shipping_local_pickup_is_available', 'wcs_pickup_min_amount', 10, 2 );
function wcs_pickup_min_amount( $is_available ) {
if ( ! $is_available ) {
return $is_available;
@norcross
norcross / calc-read-time.php
Created July 3, 2014 02:51
calculate and display an estimated reading time
<?php
/**
* handle the calculation
* @param integer $seconds [description]
* @return [type] [description]
*/
function rkv_calc_read_time( $seconds = 0 ) {
// calc the minutes
// Define gulp before we start
var gulp = require('gulp');
// Define Sass and the autoprefixer
var sass = require('gulp-sass');
var prefix = require('gulp-autoprefixer');
// This is an object which defines paths for the styles.
// Can add paths for javascript or images for example
// The folder, files to look for and destination are all required for sass
@georgiecel
georgiecel / wp-comment-callback
Created March 9, 2014 09:09
Custom callback for HTML5 friendly WordPress comment. Also includes schema.org microdata. To use, insert the following into comments.php: <?php wp_list_comments('callback=better_comment&end-callback=better_comment_close'); ?>
// awesome semantic comment
function better_comment($comment, $args, $depth) {
$GLOBALS['comment'] = $comment;
extract($args, EXTR_SKIP);
if ( 'article' == $args['style'] ) {
$tag = 'article';
$add_below = 'comment';
} else {
@kasparsd
kasparsd / href-domain-menu-item.php
Created January 21, 2014 15:31
Add destination domain as sanitized CSS class to every WordPress menu item
<?php
add_filter( 'nav_menu_css_class', 'menu_item_href_css_class', 10, 2 );
function menu_item_href_css_class( $classes, $item ) {
$url_domain = parse_url( $item->url, PHP_URL_HOST );
if ( $url_domain )
$classes[] = 'link-' . sanitize_title( $url_domain );
@t-io
t-io / osx_install.sh
Last active October 22, 2023 13:04
Install most of my Apps with homebrew & cask
#!/bin/sh
echo Install all AppStore Apps at first!
# no solution to automate AppStore installs
read -p "Press any key to continue... " -n1 -s
echo '\n'
echo Install and Set San Francisco as System Font
ruby -e "$(curl -fsSL https://raw.github.com/wellsriley/YosemiteSanFranciscoFont/master/install)"
echo Install Homebrew, Postgres, wget and cask
ruby -e "$(curl -fsSL https://raw.github.com/Homebrew/homebrew/go/install)"
@alexkingorg
alexkingorg / spam-comment-script.txt
Created December 22, 2013 16:04
A spam comment script with replacement clauses intact - accidentally submitted in it's entirety to my site.
{
{I have|I've} been {surfing|browsing} online more than {three|3|2|4} hours today, yet I never found any interesting article like yours. {It's|It is} pretty worth enough for me. {In my opinion|Personally|In my view}, if all {webmasters|site owners|website owners|web owners} and bloggers made good content as you did, the {internet|net|web} will be {much more|a lot more} useful than ever before.|
I {couldn't|could not} {resist|refrain from} commenting. {Very well|Perfectly|Well|Exceptionally well} written!|
{I will|I'll} {right away|immediately} {take hold of|grab|clutch|grasp|seize|snatch} your {rss|rss feed} as I {can not|can't} {in finding|find|to find} your {email|e-mail} subscription {link|hyperlink} or {newsletter|e-newsletter} service. Do {you have|you've} any? {Please|Kindly} {allow|permit|let} me {realize|recognize|understand|recognise|know} {so that|in order that} I {may just|may|could} subscribe. Thanks.|
{It is|It's} {appropriate|perfect|the best} time to make some plans for the future and {it is|i
@benfrain
benfrain / post-receive.sh
Last active October 30, 2023 15:55
post-receive hook for multiple branches
#!/bin/bash
while read oldrev newrev ref
do
branch=`echo $ref | cut -d/ -f3`
if [ "master" == "$branch" ]; then
git --work-tree=./path/under/root/dir/live-site/ checkout -f $branch
echo 'Changes pushed live.'
fi