All muhaza's note in developing website. Front-end & uiux method. Real life implementation for webdesigner.
Wednesday, 17 June 2020
Change Woocommerce Add to Cart Text to Something Else Functions.php
Monday, 15 June 2020
Woocommerce : Change product Role after Purchase
Tuesday, 9 June 2020
Woocommerce add to cart bottom of shop divi
Saturday, 2 May 2020
Woocommerce : Reset and Uninstall Woocommerce
Delete Woocommerce Data Completely
define('WC_REMOVE_ALL_DATA', true);
Tuesday, 28 April 2020
Wordpress : Strict to Area e.g Putrajaya
function custom_woocommerce_states( $states ) {
$states['MY'] = array(
'PJY' => 'Putrajaya'
);
return $states;
}
//add this at child theme function.php
Wednesday, 15 April 2020
AXIOS CHEAT SHEET
GET request
// Make a request for a user with a given ID axios.get('/user?ID=12345') .then(function (response) { console.log(response); }) .catch(function (error) { console.log(error); }); // Optionally the request above could also be done as axios.get('/user', { params: { ID: 12345 } }) .then(function (response) { console.log(response); }) .catch(function (error) { console.log(error); }); | |
POST request
axios.post('/user', { firstName: 'Fred', lastName: 'Flintstone' }) .then(function (response) { console.log(response); }) .catch(function (error) { console.log(error); }); | |
Multiple concurrent requests
function getUserAccount() { return axios.get('/user/12345'); } function getUserPermissions() { return axios.get('/user/12345/permissions'); } axios.all([getUserAccount(), getUserPermissions()]) .then(axios.spread(function (acct, perms) { // Both requests are now complete })); | |
POST request config
// Send a POST request axios({ method: 'post', url: '/user/12345', data: { firstName: 'Fred', lastName: 'Flintstone' } }); | |
GET request config
// GET request for remote image axios({ method: 'get', url: 'http://bit.ly/2mTM3nY', responseType: 'stream' }) .then(function(response) { response.data.pipe(fs.createWriteStream('ada_lovelace.jpg')) }); | |
Create instance
var instance = axios.create({ baseURL: 'https://some-domain.com/api/', timeout: 1000, headers: {'X-Custom-Header': 'foobar'} }); |
Monday, 6 April 2020
Javascript Concepts Functions Related
- Global Scope
- Local Scope
var greeting='Welcome to blog';
(function(){
console.log(greeting); //Output: Welcome to blog
})();
(function(){var greeting = 'Welcome to blog'; console.log(greeting); //Output: Welcome to blog })();console.log(greeting); //Output:Reference-Error greeting not defined
Friday, 6 March 2020
Set Time Out Javascript setTimeout
Thursday, 23 January 2020
svelte router @ Svero Github
Since it's exported in CommonJS format, you should be using it with a module bundler such as Rollup or Webpack.
You can install svero via npm:
npm install --save svero
Usage
The usage is super simple:
<!-- ./App.svelte -->
<script>
import { Router, Route } from 'svero';
import Index from './pages/Index.svelte';
import About from './pages/About.svelte';
import Employees from './pages/Employees.svelte';
let employees = [{ id: 1, name: 'Bill'}, { id:2, name: 'Sven' }];
</script>
<Router>
<Route path="*" component={Index} />
<Route path="/about" component={About} />
<Route path="/about/:who/123/:where" component={About} />
<Route path="/employees">
<Employees {employees}/>
</Route>
</Router>The * wildcard simply works as a fallback. If a route fails to meet any other path, it then loads the path with the *. If there is no wildcard route and the route did not meet any other path, nothing is loaded.
Your custom props can be passed by putting your component in the Route slot (Employees example above).
Paths with parameters (:param) are passed to components via props: router.params.
Parameters like
*paramwill capture the rest of segments. You can access them asrouter.params._like other params.
A component loaded by <Route> receives a property with route details:
<!-- ./pages/About.svelte -->
<script>
export let router = {};
// Those contains useful information about current route status
router.path; // /test
router.route; // Route Object
router.params; // /about/bill/123/kansas { who: 'bill', where: 'kansas' }
</script>Additional properties are passed to the mounted component, e.g.
<Route component={Test} title="Some description" />Also, you can pass an object:
<Route component={Test} props={myProps} />
Routeprops are omitted, but all remaining ones are passed toTest.
Routes can also render any given markup when they're active, e.g.
<Route path="/static-path">
<h1>It works!</h1>
</Route>You can access
routerwithin<slot />renders by declaringlet:routeron<Router />or<Route />components (see below).
If you're building an SPA or simply want to leverage on hash-based routing for certain components try the following:
<Route path="#g/:gistId/*filePath" let:router>
<p>Info: {JSON.stringify(router.params)}</p>
</Route>Standard anchors and <Link /> components will work as usual:
<a href="#g/1acf21/path/to/README.md">View README.md</a>Declaring a component <Route path="#" /> will serve as fallback when location.hash is empty.
Nesting
You can render svero components inside anything, e.g.
<Router nofallback path="/sub">
<Route>
<fieldset>
<legend>Routing:</legend>
<Router nofallback path="/sub/:bar">
<Route let:router>{router.params.bar}!</Route>
</Router>
<Route path="/foo">Foo</Route>
<Route fallback path="*" let:router>
<summary>
<p>Not found: {router.params._}</p>
<details>{router.failure}</details>
</summary>
</Route>
<Router nofallback path="/sub/nested">
<Route>
[...]
<Route fallback path="*">not found?</Route>
<Route path="/a">A</Route>
<Route path="/b/:c">C</Route>
<Route path="/:value" let:router>{JSON.stringify(router.params)}</Route>
</Route>
</Router>
</fieldset>
</Route>
</Router>Properties determine how routing will match and render routes:
- Use the
nofallbackprop for telling<Router />to disable the fallback mechanism by default - Any route using the
fallbackprop will catch unmatched routes or potential look-up errors - Use the
exactprop to skip this route from render just in case it does not matches - A
<Route />withoutpathwill render only if<Router path="..." />is active!
Note that all
<Router />paths MUST begin from the root as/suband/sub/nestedin the example.
Redirects
Sometimes you just want a route to send user to another place. You can use the redirect attribute for that.
A redirect should always be a string with a path. It uses the same pattern as path attribute. For a redirect to run, there must be a Route with the equivalent path.
<Router>
<Route path="/company" redirect="/about-us">
<Route path="/about-us" component={AboutUs}>
</Router>Conditions
If you need to meet a condition in order to run a route, you can use the condition attribute. Conditions can also be used with redirect for graceful route fallback.
A condition should be either boolean or a function returning boolean. There is no support for asynchronous conditions at the moment (so keep it simple).
<Router>
<Route path="/admin/settings" condition={isAdminLogged} redirect="/admin/login">
</Router>Think of it as a simpler middleware. A condition will run before the route loads your component, so there is no wasteful component mounting, and no screen blinking the unwanted view.
Link Component
There is also an useful <Link> component that overrides <a> elements:
<Link href="path/here" className="btn">Hello!</Link>The difference between <Link> and <a> is that it uses pushState whenever possible, with fallback to <a> behavior. This means that when you use <Link>, svero can update the view based on your URL trigger, without reloading the entire page.
Given
hrefvalues will be normalized (on-click) if they don't start with a slash, e.g. whenlocation.pathname === '/foo'then#barwould become/foo#baras result.
navigateTo()
In some cases you want to navigate to routes programatically instead of letting user click on links. For this scenario we have navigateto() which takes a route as parameter and navigates imediatelly to said route.
navigateTo() receives the same treatment as <Link>: It will always try to use pushState for better performance, fallbacking to a full page redirect if it isn't supported.
Usage:
<script>
import { onMount } from 'svelte';
import { navigateTo } from 'svero';
onMount(() => {
if (localStorage.getItem('logged')) {
navigateTo('/admin');
}
});
</script>Webpack issues
If you're having trouble with Webpack failing to load svero, please replace the following rule (in Svelte rule):
exclude: /node_modules/,with:
exclude: /node_modules\/(?!(svero)\/).*/,More information here.
Sunday, 27 October 2019
Thursday, 24 October 2019
JS : Strings
Strings
"This is a string";
'this is another string!'
Basic String properties
"Nice!".length;
//5
description.length;
Basic String methods
.includes(searchString)
"Hello World".includes("World"); // true
"Hello World".includes("Potato"); // false
.toUpperCase()
"hello".toUpperCase(); // "HELLO";
.toLowerCase()
"NICe".toLowerCase(); // "nice";
A note on tests & sample usage
function sum(a, b) {
return a + b;
}
//sample usage
sum(1, 3);
Feel free to use console.log() for the parameters of the function to see what kind of tests we're running.
A note on console.log
console.log(variable_or_expression)
Monday, 29 July 2019
Android Studio - Installing Android Target Package from terminal
sdkmanager "platform-tools" "platforms;android-26"
Monday, 22 July 2019
NPM Install with so much ERR How to fix?
Friday, 19 July 2019
Sunday, 30 June 2019
Sunday, 28 April 2019
Saturday, 27 April 2019
Material design Card Shadow css
Image Hover Effect
Imagehover.css is a lovingly crafted CSS library allowing you to easily implement scaleable image hover effects. Choose from over 40 hover effect classes from a CSS library weighing in at a minified size of only 19KB.
https://bootsnipp.com/snippets/92e5X
card style image hover
Thursday, 25 April 2019
Wednesday, 24 April 2019
Tembus Gmail dengan TXT record
Type: TXT Name: @ / domainname.com Loadtime : 14400 Value: v=spf1 a mx ip4:SERVER_IP include:netkl.org ~all
-
function member_only_shortcode($atts, $content = null) { if (is_user_logged_in() && !is_null($content) && !is_feed()) { ...
-
Press Windows + S , search for "Environment Variables" , and select: 👉 "Edit the system environment variables" Click...
