Skip to content

Instantly share code, notes, and snippets.

View whalesingswee's full-sized avatar
🍎
eating my own apple

Hsiang Lee whalesingswee

🍎
eating my own apple
View GitHub Profile
@whalesingswee
whalesingswee / disable-comments.php
Last active February 22, 2020 10:40 — forked from mattclements/function.php
Wordpress Disable Comments (add to function.php)
<?php
add_action('admin_init', function () {
// Redirect any user trying to access comments page
global $pagenow;
if ($pagenow === 'edit-comments.php') {
wp_redirect(admin_url());
exit;
}
@whalesingswee
whalesingswee / WC_Variable_Product_Price_Range
Created August 7, 2019 09:06 — forked from maion11/WC_Variable_Product_Price_Range
Changing WooCommerce Variable Products Price Range
function wc_varb_price_range( $wcv_price, $product ) {
$prefix = sprintf('%s: ', __('From', 'wcvp_range'));
$wcv_reg_min_price = $product->get_variation_regular_price( 'min', true );
$wcv_min_sale_price = $product->get_variation_sale_price( 'min', true );
$wcv_max_price = $product->get_variation_price( 'max', true );
$wcv_min_price = $product->get_variation_price( 'min', true );
$wcv_price = ( $wcv_min_sale_price == $wcv_reg_min_price ) ?
# working with npm
npm install -g yarn
npm install -g npx
npm install -g np
npm install -g npm-name-cli
# debugging
npm install -g ndb
npm install -g node-inspector
@whalesingswee
whalesingswee / wp-config.php
Created February 18, 2019 02:27
Limit the number of posts revisions that WordPress stores in the database
//The limit can be set in wp-config.php:
define('WP_POST_REVISIONS', 3);
//WP_POST_REVISIONS:
// true (default), -1: store every revision
// false, 0: do not store any revisions (except the one autosave per post)
// (int) > 0: store that many revisions (+1 autosave) per post. Old revisions are automatically deleted.
@whalesingswee
whalesingswee / app.js
Created December 17, 2015 02:40 — forked from sogko/app.js
gulp + expressjs + nodemon + browser-sync
'use strict';
// simple express server
var express = require('express');
var app = express();
var router = express.Router();
app.use(express.static('public'));
app.get('/', function(req, res) {
res.sendfile('./public/index.html');
(function () {
if (!window.fluid) {
alert("This script is meant to be run in Fluid! You should disable it.");
return;
}
window.fluid.dockBadge = '';
setInterval(newNotif, 500);
@whalesingswee
whalesingswee / css_resources.md
Created December 26, 2013 04:19 — forked from jookyboi/css_resources.md
CSS libraries and guides to bring some order to the chaos.

Libraries

  • 960 Grid System - An effort to streamline web development workflow by providing commonly used dimensions, based on a width of 960 pixels. There are two variants: 12 and 16 columns, which can be used separately or in tandem.
  • Compass - Open source CSS Authoring Framework.
  • Bootstrap - Sleek, intuitive, and powerful mobile first front-end framework for faster and easier web development.
  • Font Awesome - The iconic font designed for Bootstrap.
  • Zurb Foundation - Framework for writing responsive web sites.
  • SASS - CSS extension language which allows variables, mixins and rules nesting.
  • Skeleton - Boilerplate for responsive, mobile-friendly development.

Guides

@whalesingswee
whalesingswee / javascript_resources.md
Created December 26, 2013 04:19 — forked from jookyboi/javascript_resources.md
Here are a set of libraries, plugins and guides which may be useful to your Javascript coding.

Libraries

  • jQuery - The de-facto library for the modern age. It makes things like HTML document traversal and manipulation, event handling, animation, and Ajax much simpler with an easy-to-use API that works across a multitude of browsers.
  • Backbone - Backbone.js gives structure to web applications by providing models with key-value binding and custom events, collections with a rich API of enumerable functions, views with declarative event handling, and connects it all to your existing API over a RESTful JSON interface.
  • AngularJS - Conventions based MVC framework for HTML5 apps.
  • Underscore - Underscore is a utility-belt library for JavaScript that provides a lot of the functional programming support that you would expect in Prototype.js (or Ruby), but without extending any of the built-in JavaScript objects.
  • lawnchair - Key/value store adapter for indexdb, localStorage