Skip to content

Instantly share code, notes, and snippets.

@rambuvn
rambuvn / slider-fullwidth.liquid
Created June 4, 2022 05:50
Shopify Section Full Width Slider: Create a section that display slider combine with swiperjs
<div class="rb-slider swiper-container">
<!-- Slider main container -->
<div class="swiper">
<!-- Additional required wrapper -->
<div class="swiper-wrapper">
<!-- Slides -->
{% for block in section.blocks %}
<div class="swiper-slide">
<img src="{{ block.settings.image | image_url }}" />
</div>
@rambuvn
rambuvn / minesweeper.js
Last active August 28, 2019 08:25
active mine without mouse click http://minesweeperonline.com/#200
var rbMouse = {
x: 0,
y: 0
};
$(document).on('mousemove', function(evt){
rbMouse = {
x: evt.clientX,
y: evt.clientY
}
});
$('.stretch-text').each(function(index, el) {
var line = $(el);
line.html('<span class="stretch-it">'+line.text()+'</span>');
var text = line.find('.stretch-it' );
var textLength = line.text().length,
textWidth = text.width();
var spacing = line.width() - textWidth;
var lt_spacing = spacing / textLength;
<?php get_header('dwqa'); ?>
<?php do_action( 'dwqa_before_page' ) ?>
<?php if (is_user_logged_in()) : ?>
<div id="submit-question" class="dwqa-submit-question">
<?php
global $dwqa_options, $dwqa_current_error;
if( is_wp_error( $dwqa_current_error ) ) {
$error_messages = $dwqa_current_error->get_error_messages();
@rambuvn
rambuvn / gist:11311568
Last active August 29, 2015 14:00
dwqa submit question page
<?php get_header('dwqa'); ?>
<?php do_action( 'dwqa_before_page' ) ?>
<div id="submit-question" class="dwqa-submit-question">
<?php
global $dwqa_options, $dwqa_current_error;
if( is_wp_error( $dwqa_current_error ) ) {
@rambuvn
rambuvn / gist:10961432
Last active May 27, 2018 21:47
Show list questions in specify category or tag
add_shortcode( 'dwqa-list-questions-with-taxonomy', 'dwqa_archive_question_shortcode' );
function dwqa_archive_question_shortcode( $atts ) {
global $script_version, $dwqa_sript_vars;
extract( shortcode_atts( array(
'taxonomy_category' => '',//Use slug
'taxonomy_tag' => '',//Use slug
), $atts, 'bartag' ) );
ob_start( array( $this, 'sanitize_output' ) );
@rambuvn
rambuvn / dwqa-submit-question-form-2.php
Created March 18, 2014 10:04
The shortcode for show question of one category
<?php
function dwqa_submit_question_form_varius_category_shortcode($atts){
global $dwqa_sript_vars, $script_version;
extract( shortcode_atts( array(
'category' => 0
), $atts ) );
if( ! $category ) {
@rambuvn
rambuvn / content-end-wrapper.php
Created February 28, 2014 10:14
Show sidebar of DW QA
<?php
if ( ! defined( 'ABSPATH' ) ) exit;
global $dwqa_options;
if( ( $dwqa_options['pages']['archive-question'] && is_page( $dwqa_options['pages']['archive-question'] ) ) || is_archive() ) { ?>
</div>
<div id="secondary">
<?php if (is_user_logged_in()) : ?>
<?php dwqa_get_ask_question_link( true, false, 'btn btn-block btn-success' ); ?>
<?php else : ?>
<a data-toggle="modal" class="open-login-modal btn btn-block btn-success" data-referer="http://www.designwall.com/ask-question/" href="#loginModal" alt="signin-tab">Login to Ask question</a>
@rambuvn
rambuvn / experts.php
Created February 18, 2014 04:43
Experts list style like Designwall
<?php
/**
* Template Name: Experts List
*/
get_header(); ?>
<div id="content">
<?php while ( have_posts() ) : the_post(); ?>
<article <?php post_class(); ?>>
<header class="page-header">
<h1 class="page-title"><?php the_title(); ?></h1>
@rambuvn
rambuvn / rb_eta.php
Created February 13, 2014 07:40
Estimate Reading Time For Wordpress
/** Estimate Reading Time
*----------------*/
if( !function_exists('rb_timeline_eta') ) {
function rb_timeline_eta(){
global $post;
$words_per_minute = 270;
$words_per_second = $words_per_minute / 60;
$post_content = $post->post_content;
$word_count = str_word_count(strip_tags($post_content));