Skip to content

Instantly share code, notes, and snippets.

Sovit Tamrakar ssovit

Block or report user

Report or block ssovit

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@ssovit
ssovit / fontaweomse-stars.php
Last active Dec 19, 2018
Create FontAwesome static rating bar based on rating data
View fontaweomse-stars.php
<?php
function createFontAwesomeStarRating($rating=0,$min=0,$max=10,$maxStars=5,$return=false){
$score=(($rating - $min) * ($maxStars)) / ($max - $min) ;
$full=floor($score);
$half=ceil($score)-$full;
$empty=$maxStars-$full-$half;
$result='<div class="rating-stars" title="'.$score.'">';
$result.=str_repeat('<i class="fa fa-star"></i>',$full);
$result.=str_repeat('<i class="fa fa-star-half-o"></i>',$half);
$result.=str_repeat('<i class="fa fa-star-o"></i>',$empty);
@ssovit
ssovit / clear-cache.php
Created Sep 28, 2017
Auto clean autoptimize cache once a month
View clear-cache.php
<?php
namespace wppress;
class GarbageCollection
{
public function __construct()
{
add_filter('cron_schedules', function ($schedules) {
$schedules['weekly'] = array(
'interval' => 604800,
View svgPHPArray.js
var svgPHPArray = function (dest) {
var File = gutil.File;
var files = [];
var prepareFiles = function (f, enc, cb) {
if (f.isNull()) {
cb();
return;
}
if (f.isStream()) {
cb();
@ssovit
ssovit / gulpfile.js
Created Sep 8, 2016
Gulp - Nicely Commented Less Import from a folder
View gulpfile.js
var gulp = require('gulp');
var less = require('gulp-less');
var lessImport=require('less-imports.js');
gulp.task('less_parts', function() {
gulp.src("src/less/parts/*.less")
.pipe(lessImport('style.css'))
.pipe(less())
.pipe(gulp.dest("./"));
View popular-post-class.php
<?php
class WPPress_Post_Views
{
function __construct() {
add_action('wp_ajax_post_heartbeat', array(&$this,
'increase'
));
add_action('wp_ajax_nopriv_post_heartbeat', array(&$this,
'increase'
You can’t perform that action at this time.